hdoj-5053-the Sum of Cube
来源:互联网 发布:画图软件图标大全 编辑:程序博客网 时间:2024/05/29 15:08
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
题意:算区间立方和
题解:直接暴力
#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>using namespace std;typedef long long ll;int main(){ ll a,b,sum; int t; int cas = 0; scanf("%d",&t); while(t--) { sum = 0; scanf("%I64d%I64d",&a,&b); for(ll i = a; i <= b; i++) { sum+=i*i*i; } printf("Case #%d: %I64d\n",++cas,sum); } return 0;}
0 0
- 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 the Sum of Cube 5053 (简单数学)
- HDOJ 5053 the Sum of Cube (立方和)
- hdoj 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
- HDU-#5053 the Sum of Cube
- 【水题】HDU 5053 the Sum of Cube
- HDU - 5053 the Sum of Cube
- HDU 5053 the Sum of Cube
- HDU--5053 the Sum of Cube
- 一个留学生的自白:清华vsMIT
- JavaWeb之Cookie_Session
- DirectX导图(7):纹理
- Nginx负载均衡
- DirectX导图(8):混合
- hdoj-5053-the Sum of Cube
- 【HDU 3333】【离线询问 树状数组 前驱思想】Turing Tree【 求区间中不同的数的和】
- jQuery扩展函数
- 电路设计_硬件工程师需要考虑的问题
- 需要精确答案,避免使用float和double
- DirectX导图(9):模版
- 啊哈算法DFS应用之解救小哈
- Handler消息机制分析
- 直播通过VM虚拟机和移动硬盘安装Kail Linux