首页 > 代码库 > HDU 5053 the Sum of Cube

HDU 5053 the Sum of Cube

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5053

解题报告:用来陶冶情操的题,求a到b的三次方的和。

 1 #include<stdio.h> 2 #include<string.h> 3 #define INT __int64 4 int main() 5 { 6     int T,kase = 1; 7     scanf("%d",&T); 8     INT a,b; 9     while(T--)10     {11         scanf("%I64d%I64d",&a,&b);12         INT sum = 0;13         for(INT i = a;i <= b;++i)14         sum += i * i * i;15         printf("Case #%d: %I64d\n",kase++,sum);16     }17     return 0;18 }
View Code

 

HDU 5053 the Sum of Cube