[解题报告]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;
}

 

 

posted @ 2013-02-25 17:59  乱七八糟 。  阅读(138)  评论(0编辑  收藏  举报