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. mysql 时间向减写法

    select *  from  (   select  c.OrderNumber ,    c.Name as equipmentName,     a.*,    d.Starttime, d.E ...

  2. shiro之IniRealm

    Shiro认证过程 创建SecurityManager--->主体提交认证--->SecurityManager认证--->Authenticsto认证--->Realm验证 ...

  3. linux系统资源限制ulimit

    ulimit命令用来限制系统用户对shell资源的访问.如果不懂什么意思,下面一段内容可以帮助你理解: 假设有这样一种情况,当一台 Linux 主机上同时登陆了 10 个人,在系统资源无限制的情况下, ...

  4. 2017 JUST Programming Contest 3.0 K. Malek and Summer Semester

    K. Malek and Summer Semester time limit per test 1.0 s memory limit per test 256 MB input standard i ...

  5. [转]Using the Interop Activity in a .NET Framework 4 Workflow

    本文转自:http://msdn.microsoft.com/en-us/library/ee264174(v=vs.100).aspx This topic applies to Windows W ...

  6. 关于C# DropDownList 动态加载数据笔记

    今天在处理一个导游注册的页面,其中需要填写地址以及该地址下所有旅行社,地址区级以上都是用下拉列表实现,具体地址街道等手动填写.在填写区县之后,该区县下的所有旅行社也需要动态加载. 后台代码 DataT ...

  7. IO流的原理和概念

    在程序中如何读写文件?不同的编程语言有不同的方式,而 JAVA 则提出了“流”的概念,通过“流”来读写文件 什么是流: 流(Stream)是指一连串的数据(字符或字节),是以先进先出的方式发送信息的通 ...

  8. mysql之修改字符编码

    目录 统一修改字段编码 修改单个字段编码 修改表字符编码 统一修改字段编码: alter table `tablename` convert to character set utf8; 修改表字符编 ...

  9. 提交应用 Windows Phone的应用程序认证要求

    本文介绍了 Windows Phone 应用程序或游戏要通过认证并在 Windows Phone Marketplace 中发布而必须满足的策略和技术要求. 1.0 计划概述 设计认证过程的一个核心原 ...

  10. TCP/UDP套接字 java socket编程实例

    网络协议七层结构: 什么是Socket? socket(套接字)是两个程序之间通过双向信道进行数据交换的端,可以理解为接口.使用socket编程也称为网络编程,socket只是接口并不是网络通信协议. ...