2014上海网络赛 HDU 5053 the Sum of Cube

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include<math.h>
 4 #include<iostream>
 5 #define LL long long
 6 using namespace std;
 7 
 8 int main()
 9 {
10     int t;
11     int a,b;
12     int cas;
13     LL sum;
14     while(~scanf("%d",&t))
15     {
16         for(int i=1;i<=t;i++)
17         {
18             sum=0;
19             scanf("%d%d",&a,&b);
20             for(int j=a;j<=b;j++)
21             {
22                 sum+=pow(j,3);
23             }
24             printf("Case #%d: %lld\n",i,sum);
25         }
26     }
27     return 0;
28 }
View Code

 

posted @ 2015-10-24 23:23  yyblues  阅读(178)  评论(0编辑  收藏  举报