hdu 2114 Calculate S(n) (递推)

点击打开链接

ps:立方和公式:1^3 + 2^3 + …… n^3 = [n (n+1) / 2]^2=(1+2+……+n)^2

#include<stdio.h>
void main()
{
    int n;
    int sum;
    while(scanf("%d",&n)!=EOF)
    {
        n=n000;
        sum=(((n*(n+1)/2)000)*((n*(n+1)/2)000))000;
        printf("d\n",sum);
    }
	
}


posted on 2012-10-14 17:36  Slege  阅读(110)  评论(0编辑  收藏  举报

导航