[解题报告]10302 Summation of Polynomials

题目大意

题目原文:http://uva.onlinejudge.org/external/103/10302.pdf

背景:

 
其实就是求1到n的立方和

输入:

 

 见sample intput

输出:

见sample output

 

Sample Input

 

1

 

2

 

3

 

 

Sample Output

 

1

 

9

 

36

 



算法:

 水题,直接上代码。

 

代码:

这里附上我的代码,你可以去这里提交你的代码验证你的代码是否正确。

View Code
#include<stdio.h>
int main(void)
{
    int x;
    long long y,a;

    while(scanf("%d",&x)!=EOF)
    {
        a=0;
        for (y=1; y<=x; y++)
        a+=y*y*y;
        printf("%lld\n",a);
    }
    return 0;
}

 

原文地址:https://www.cnblogs.com/qisong178878915/p/2932503.html