您的位置:首页 > 其它

[解题报告]10302 - Summation of Polynomials

2013-02-25 17:59 190 查看

题目大意

题目原文: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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: