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. 打开CAD时出现“acvmtools.arx ARX命令中发生异常

    打开CAD时出现“acvmtools.arx ARX命令中发生异常     解决办法1: 试试进入CAD安装的目录,删掉它acvmtools.arx,重新打开cad.(注:acvmtools.arx一 ...

  2. Python3进行RSA2加密、解密、签名

    1.python3的PyCryptodome库用于密码学,属于对PyCrypto库的扩展 Linux上安装: pip install pycryptodome Windows上安装: pip inst ...

  3. 2017 JUST Programming Contest 3.0 B. Linear Algebra Test

    B. Linear Algebra Test time limit per test 3.0 s memory limit per test 256 MB input standard input o ...

  4. chromedriver与chrome版本对应

    今天把手头有的一些关于selenium测试的资源整理了一下,分享出来. 1. 所有版本chrome下载 是不是很难找到老版本的chrome?博主收集了几个下载chrome老版本的网站,其中哪个下载的是 ...

  5. jsp错误处理

    jsp提供了很好的错误能力,除了在java代码中可以使用try语句,还可以指定一个特殊页面,当页面应用遇到未捕获的异常时,用户将看到一个精心设计的网页解释发生了什么,而不是一个用户无法理解的错误信息. ...

  6. 435 Non-overlapping Intervals 无重叠区间

    给定一个区间的集合,找到需要移除区间的最小数量,使剩余区间互不重叠.注意:    可以认为区间的终点总是大于它的起点.    区间 [1,2] 和 [2,3] 的边界相互“接触”,但没有相互重叠.示例 ...

  7. 415 Add Strings 字符串相加

    给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和.注意:    num1 和num2 的长度都小于 5100.    num1 和num2 都只包含数字 0-9.    num1 和 ...

  8. 222 Count Complete Tree Nodes 完全二叉树的节点个数

    给出一个完全二叉树,求出该树的节点个数.完全二叉树的定义如下:在完全二叉树中,除了最底层节点可能没填满外,其余每层节点数都达到最大值,并且最下面一层的节点都集中在该层最左边的若干位置.若最底层为第 h ...

  9. Jquery操作常用表单元素

    由于对前端的东西不是很熟练,导致jquery操作表单的东西总是忘记,每次用都要查一下,效率低下,记录下来,以便下次使用. CheckBox checkbox改变事件 $('#IsAllSearch') ...

  10. php中除法取整的方法(round,ceil,floor)

    PHP中遇到需要将除法所得结果取整的情况时,就需要用到以下方法: 1. round:四舍五入 round() 函数对浮点数进行四舍五入. 语法:round(x, prec) 参数 描述 x 可选.规定 ...