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. 设置Google搜索在新的标签页打开

    Google搜索的结果,默认情况下点击进入是在本标签页打开的,这样就很麻烦, 可以在搜索结果的页面中进行设置,让它在新的标签页显示 搜索结果设置->搜索设置->新的标签页打开

  2. BZOJ 1396||2865 识别子串

    这个不是题解,看不懂的,别看了 明明应该是会的,怎么还是写了6个小时呢... 把后缀数组.height数组.排名数组求出来,那么对于原串s的任意子串[x,y](表示第x个到第y个字符组成的子串,字符从 ...

  3. MyEclipse配置Tomcat

    1.在Window->Perferences->MyEclipse->Servers->Tomcat->Tomcat 7.x中启用Tomcat并配置Tomcat路径和JD ...

  4. UML 活动图(转载)

    活动图:用于表示系统中各种活动的次序,它的应用非常广泛,即可用来描述用例的工作流程,也可用来描述类中某个方法的操作行为.常用于表示业务流程,对系统功能建模,强调对象之间的控制流.活动图是由状态图变化而 ...

  5. js学习笔记-事件委托

    通过事件委托,你可以把事件处理器绑定到父元素上,避免了把事件处理器添加到多个子级元素上.从而优化性能. 事件代理用到了事件冒泡和目标元素.而任何一个元素的目标元素都是一开始的那个元素. 这里首先要注意 ...

  6. 支付宝-API接口解析-转账到银行

    支付宝-API接口解析-转账到银行 扫码转账 测试地址 解析内容: alipays://platformapi/startapp?appId=09999988&actionType=toCar ...

  7. idea 部署struts所遇到的问题\

    1.org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter 加载失败 解决方法:下载struts2 的源码包,然后将D:\ ...

  8. jmeter 连接 sqlite 进行压力测试

  9. iOS----创建静态库

    静态库 1.什么是库? 库是程序代码的集合,是共享程序代码的一种方式 2.根据源代码的公开情况,库可以分为2种类型 开源库 公开源代码,能看到具体实现 比如SDWebImage.AFNetworkin ...

  10. ES6扩展运算符的使用

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...