hdu 5053 the Sum of Cube(上海网络赛)
the Sum of Cube
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 405 Accepted Submission(s): 224
Each case of input is a pair of integer A,B(0 < A <= B <= 10000),representing the range[A,B].
2
1 3
2 5
Case #1: 36
Case #2: 224
代码:
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std; int main()
{
long long a,b;
int ca=1;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%I64d%I64d",&a,&b);
printf("Case #%d: %I64d\n",ca++,(b*(b+1)/2)*(b*(b+1)/2)-(a*(a-1)/2)*(a*(a-1)/2));
}
return 0;
}
hdu 5053 the Sum of Cube(上海网络赛)的更多相关文章
- 2014上海网络赛 HDU 5053 the Sum of Cube
水 #include <stdio.h> #include <stdlib.h> #include<math.h> #include<iostream> ...
- HDU 5053 the Sum of Cube
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5053 解题报告:用来陶冶情操的题,求a到b的三次方的和. #include<stdio.h> ...
- 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 ...
- 杭电 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 ...
- HDU 4759 Poker Shuffle(2013长春网络赛1001题)
Poker Shuffle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- HDU 5875 Function -2016 ICPC 大连赛区网络赛
题目链接 网络赛的水实在太深,这场居然没出线zzz,差了一点点,看到这道题的的时候就剩半个小时了.上面是官方的题意题解,打完了才知道暴力就可以过,暴力我们当时是想出来了的,如果稍稍再优化一下估计就过了 ...
- HDU 4763 Theme Section (2013长春网络赛1005,KMP)
Theme Section Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- HDU 4751 Divide Groups (2013南京网络赛1004题,判断二分图)
Divide Groups Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- HDU 4745 Two Rabbits (2013杭州网络赛1008,最长回文子串)
Two Rabbits Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Tota ...
随机推荐
- QtQuick桌面应用程序开发指南 4)动态管理Note对象_B 5)加强外观 6)许多其他的改进
4.2.2 Stateless(不管状态)JavaScript库 为了让开发轻松点, 使用一个JavaScript接口来和数据库交互是个好主意, 它在QML中提供了方便的方法; 在QtCreator中 ...
- OpenCV——Delaunay三角 [转载]
从这个博客转载 http://blog.csdn.net/raby_gyl/article/details/17409717 请其它同学转载时注明原始文章的出处! Delaunay三角剖分是1934年 ...
- MSXML2;System.ServiceModel.Configuration;对应dll的添加方法
- c# 用正则表达式在指定的字符串中每隔指定个数的文字插入指定字符串
public static string AddNewLine(string inString,int num,string addString="\r\n") { return ...
- LeetCode Solutions : Reorder List
→-→Ln-1→Ln, reorder it to: L→Ln-2→- You must do this in-place without altering the nodes' values. Fo ...
- java中的移位运算符:<<,>>,>>>总结(转)
java中有三种移位运算符 << : 左移运算符,num << 1,相当于num乘以2 >> : 右移运算符,num >& ...
- iPhone&iPad DFU及恢复模式刷机、降级教程
再次提醒,刷机需慎重处理. http://blog.csdn.net/ztp800201/article/details/11980643 iphone一共同拥有三种工作模式,各自是正常模式,恢复模式 ...
- HttpWebRequest BeginGetResponse EndGetResponse
private void Button_Click_4(object sender, RoutedEventArgs e) { HttpWebRequest request = HttpWebRequ ...
- Python第一个基本教程6章 抽象的
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "copyri ...
- 它的斗争“和loser对话”短篇故事
今天,一个朋友发来的图片故事,尽管听说过,但见一.仍感慨颇多. 有时总是说easy,其实做起来的另一个故事. 想实现梦想,看来还是要脚踏实地,一步一步.不断努力,不断前行啊! 版权声明:本文博客原创文 ...