the Sum of Cube

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 162    Accepted Submission(s): 101

Problem 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
 
Source
 
1^3+2^3+4^3.....+n^3=(n*(n+1)/2)^2
代码:
 #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std; int main()
{
int cas;
__int64 a,b;
scanf("%d",&cas);
for(int i=;i<=cas;i++)
{
scanf("%I64d%I64d",&a,&b);
printf("Case #%d: %I64d\n",i,(b*(b+)/)*(b*(b+)/)-(a*(a-)/)*(a*(a-)/));
}
return ;
}

hdu----(5053)the Sum of Cube(签到题,水体)的更多相关文章

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

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

  2. HDU 5053 the Sum of Cube

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

  3. 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 ...

  4. 2014上海网络赛 HDU 5053 the Sum of Cube

    水 #include <stdio.h> #include <stdlib.h> #include<math.h> #include<iostream> ...

  5. HDU5053the Sum of Cube(水题)

    HDU5053the Sum of Cube(水题) 题目链接 题目大意:给你L到N的范围,要求你求这个范围内的全部整数的立方和. 解题思路:注意不要用int的数相乘赋值给longlong的数,会溢出 ...

  6. 杭电 5053 the Sum of Cube(求区间内的立方和)打表法

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

  7. 2017 Multi-University Training Contest - Team 1 1001&&HDU 6033 Add More Zero【签到题,数学,水】

    Add More Zero Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)T ...

  8. HDU - 2058 The sum problem(思路题)

    题目: Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the ...

  9. H - the Sum of Cube(水题)

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

随机推荐

  1. JS中 window.location 与window.location.href的区别

    疑惑:window.location='url'  与window.lcoation.href='url'效果一样,都会跳转到新页面,区别在哪?查得的资料如下: 1:window.location是页 ...

  2. A Star算法笔记

    回顾A*算法,偶得一源代码,略有瑕疵,改正之,并置于下. using System; using System.Collections.Generic; using System.Linq; usin ...

  3. vim配置php开发环境

    1.ctags-用于代码间的跳转 安装 sudo apt-get install ctags 使用 1). 在某个目录下, 建立tags. ctags -R . --执行之后会在当前目录下生成一个ta ...

  4. 个人作业Week 2 ----------代码的规范和代码复审

    1.是否需要有代码规范 从个人理解的角度出发,我认为代码规范还可以细分为代码的风格还有代码的结构设计(就好比排版一类的) 以前在上C语言课程的时候就看到过,老师会在打“{”的时候进行一个换行,但是有些 ...

  5. Scrum Meeting---Six(2015-11-1)

    说明 由于周五放假,我们团队部分队员回家和外出,所以这一次的Scrum Meeting我们推迟到周日晚上,在周末的这段时间内队员对自己做的任务在周日晚汇报给我. 周末完成任务以及周一计划任务 姓名 周 ...

  6. 《转》Ubuntu 12.04常用的快捷键

    Ubuntu 12.04常用的快捷键   超级键操作   1.超级键(Win键)–打开dash.   www.2cto.com   2.长按超级键– 启动Launcher.并快捷键列表.   3.按住 ...

  7. Java抓取网页数据(原网页+Javascript返回数据)

    有时候由于种种原因,我们需要采集某个网站的数据,但由于不同网站对数据的显示方式略有不同! 本文就用Java给大家演示如何抓取网站的数据:(1)抓取原网页数据:(2)抓取网页Javascript返回的数 ...

  8. jj前端项目1th总结

    1:设计图--->分出几个独立模块--->颗粒化布局--->文档流控制整体布局--->固定位置的元素绝对定位,段落这种元素不可绝对定位.----->加上和后台交互用的js ...

  9. poj3714Raid(平面最近点对)

    链接 模板 稍加一点标记 模板 #include <iostream> #include<cstdio> #include<cstring> #include< ...

  10. Linux命令之nslookup

    http://www.computerhope.com/unix/unslooku.htm About nslookup The nslookup command is used to query i ...