码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 5053 the Sum of Cube

时间:2014-09-29 19:40:11      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   for   sp   

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

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

bubuko.com,布布扣
 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

标签:style   blog   http   color   io   os   ar   for   sp   

原文地址:http://www.cnblogs.com/xiaxiaosheng/p/4000646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!