“Sometimes it is the people no one can imagine anything of who do the things no one can imagine.” ― Sir Alan Turing


ADS

ADS

Saturday, April 8, 2017

UVa 10302 Summation of Polynomials Solution in C / C++



Source Code

#include<stdio.h>

#include<math.h>

int main() {
  long double n, sum;
  while (scanf("%Lf", & n) == 1) {
    sum = (n * n * (n + 1) * (n + 1)) / 4;
    printf("%.0Lf\n", sum);
  }
  return 0;
}

No comments:

Post a Comment