Description

A range is given, the begin and the end are both integers. You should sum the cube of all the integers in the range.
 

Input

The first line of the input is T(1 <= T <= 1000), which stands for the number of test cases you need to solve. 
Each case of input is a pair of integer A,B(0 < A <= B <= 10000),representing the range[A,B].
 

Output

For each test case, print a line “Case #t: ”(without quotes, t means the index of the test case) at the beginning. Then output the answer – sum the cube of all the integers in the range.
 

Sample Input

2
1 3
2 5
 

Sample Output

Case #1: 36
Case #2: 224
 
 #include<cstdio>
__int64 a[]={,};
int main()
{
for(__int64 i=;i<=;i++)
{
a[i]=a[i-]+i*i*i;
}
__int64 t,k=;;
scanf("%I64d",&t);
while(t--)
{
__int64 m,n;
scanf("%I64d%I64d",&m,&n);
printf("Case #%I64d: %I64d\n",++k,a[n]-a[m-]);
}
}
 
 
 
 
 
 
 

杭电 5053 the Sum of Cube(求区间内的立方和)打表法的更多相关文章

  1. HDU 3709 Balanced Number 求区间内的满足是否平衡的数量 (数位dp)

    平衡数的定义是指,以某位作为支点,此位的左面(数字 * 距离)之和 与右边相等,距离是指某位到支点的距离; 题意:求区间内满足平衡数的数量 : 分析:很好这又是常见的数位dp , 不过不同的是我们这次 ...

  2. HDU 4417 Super Mario(主席树求区间内的区间查询+离散化)

    Super Mario Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  3. HDU4622:Reincarnation(后缀数组,求区间内不同子串的个数)

    Problem Description Now you are back,and have a task to do: Given you a string s consist of lower-ca ...

  4. hdu 5053 the Sum of Cube(上海网络赛)

    the Sum of Cube Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. SPOJ 3267 D-query(离散化+主席树求区间内不同数的个数)

    DQUERY - D-query #sorting #tree English Vietnamese Given a sequence of n numbers a1, a2, ..., an and ...

  6. 杭电1003 Max Sum 【连续子序列求最大和】

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1003 题目意思: 即给出一串数据,求连续的子序列的最大和 解题思路: 因为我们很容易想到用一个max ...

  7. HDU 5053 the Sum of Cube

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5053 解题报告:用来陶冶情操的题,求a到b的三次方的和. #include<stdio.h> ...

  8. HDU 5053 the Sum of Cube(简单数论)

    http://acm.hdu.edu.cn/showproblem.php?pid=5053 题目大意: 求出A^3+(A+1)^3+(A+2)^3+...+B^3和是多少 解题思路: 设f(n)=1 ...

  9. 杭电 4883 TIANKENG’s restaurant (求饭店最少需要座椅)

    Description TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of custo ...

随机推荐

  1. NOIp 2014 联合权值 By cellur925

    题目传送门 这题自己(真正)思考了很久(欣慰). (轻而易举)地发现这是一棵树后,打算从Dfs序中下功夫,推敲了很久规律,没看出来(太弱了). 开始手动枚举距离为2的情况,模模糊糊有了一些概念,但没有 ...

  2. 标准块CP功能实现

    #include<stdio.h> int main(int argc,char *argv[]) { FILE *src_fp,*des_fp; int src_ret; ]={}; ) ...

  3. MyEclipse2014+Maven配置记录

    一.MyEclipse配置Maven 打开MyEclipse2014,选择菜单:Window --> Preferences,选择:MyEclipse-Maven4MyEclipse-Insta ...

  4. XmlPullParser接口详述

    带*的是非常重要的函数.点击有说明.setInputgetDepthisWhitespacegetTextisEmptyElementTaggetAttributeCountgetAttributeV ...

  5. Access2010 - 数据类型[转]

    原文链接 Access允许十种数据类型:文本.备注.数值.日期/时间.货币.自动编号.是/否.OLE对象.超级链接.附件.查询向导 . 文本(Text):这种类型允许最大255个字符或数字,Acces ...

  6. B/S和C/S示意图

    B/S C/S

  7. linux系统添加java和glassfish环境变量

    第一种方法: 可以在/etc/profile里面增加 #java环境变量 JAVA_HOME=/home/harries/develop/jdk1.6.0_23export JRE_HOME=/hom ...

  8. SpringCloud开发学习总结(一)—— 基础知识

    1:Dubbo和Spring Cloud的关系 就我个人对这两个框架的使用经验和理解,打个不恰当的比喻:使用Dubbo构建的微服务架构就像组装电脑,各环节我们的选择自由度很高,但是最终结果很有可能因为 ...

  9. axis2与eclipse的整合:开始一个简单的axis2 的demo

    1.下载axis2,现在axis2最新版本是axis2-1.6.2,下载地址:http://axis.apache.org/axis2/java/core/download.cgi 2.下载好的zip ...

  10. js几个逻辑运算符的形象概括

    “&&”是逻辑与操作符,只有“&&”两边值同时满足(同时为真),整个表达式值才为真. b>a && b<c    //“&& ...