hdoj the Sum of Cube 5053 (简单数学)
来源:互联网 发布:ghgvh软件 编辑:程序博客网 时间:2024/05/15 20:25
the Sum of Cube
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1971 Accepted Submission(s): 805
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].
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
21 32 5
Sample Output
Case #1: 36Case #2: 224#include<stdio.h>#include<math.h>#define ll __int64int main(){int t,T=1;ll n,m;scanf("%d",&t);while(t--){scanf("%I64d%I64d",&n,&m);ll s=(n*n*(n-1)*(n-1)/4);ll ss=(m*m*(m+1)*(m+1)/4);ll sum=ss-s;printf("Case #%d: %I64d\n",T++,sum);}return 0;}
0 0
- hdoj the Sum of Cube 5053 (简单数学)
- hdoj 5053 the Sum of Cube [数学 立方求和]
- HDOJ 5053 the Sum of Cube
- HDOJ-5053(the Sum of Cube)
- HDOJ--5053--the Sum of Cube
- hdoj-5053-the Sum of Cube
- hdoj--5053--the Sum of Cube(水)
- HDOJ 5053 the Sum of Cube (立方和)
- HDU 5053 the Sum of Cube(数学求立方和)
- the Sum of Cube
- The Sum of Cube
- the Sum of Cube
- the Sum of Cube
- the Sum of Cube
- 杭电acm 5053 the Sum of Cube(简单水题)
- Hdu-5053 the Sum of Cube(水题)
- hdu 5053 the Sum of Cube(上海网络赛)
- hdu 5053 the Sum of Cube(水)
- 机器学习算法及应用领域相关的中国大牛
- ZYB's Biology解题报告
- W3C代码标准规范
- PS替换图标颜色
- [LeetCode]Minimum Height Trees
- hdoj the Sum of Cube 5053 (简单数学)
- 微信语音识别和语义理解接口
- C语言之结构体
- [译]Android音频: 如何使用AudioTrack播放一个WAV格式文件?
- C语言程序设计整理(1)
- C++的异常捕捉
- 启动一个倒计时器
- 去除搜狐广告
- 计蒜客—外卖餐厅的展示(简单)