hdu 5053 水

http://acm.hdu.edu.cn/showproblem.php?pid=5053

ll就不超范围

写一道BFS题写的烦了 来水一道

//#pragma comment(linker, "/STACK:102400000,102400000")
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <queue>
using namespace std;

#define ls(rt) rt*2
#define rs(rt) rt*2+1
#define ll long long
#define ull unsigned long long
#define rep(i,s,e) for(int i=s;i<e;i++)
#define repe(i,s,e) for(int i=s;i<=e;i++)
#define CL(a,b) memset(a,b,sizeof(a))
#define IN(s) freopen(s,"r",stdin)
#define OUT(s) freopen(s,"w",stdout)
const ll ll_INF = ((ull)(-1))>>1;
const double EPS = 1e-8;
const double pi = acos(-1.0);
const int INF = 100000000;

int main()
{
    int ncase;
    ll ans;
    scanf("%d",&ncase);
    int ic=0;
    while(ncase--)
    {
        ans=0;
        ll l,r;
        scanf("%I64d%I64d",&l,&r);
        for(ll i=l;i<=r;i++)
            ans+=i*i*i;
        printf("Case #%d: %I64d\n",++ic,ans);
    }
    return 0;
}
时间: 2024-08-03 19:27:57

hdu 5053 水的相关文章

HDU 4968 (水dp 其他?)

1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <vector> 5 #include <map> 6 using namespace std; 7 const int inf = 0x3f3f3f3f; 8 const int MAX = 200+10; 9 double GPA[10],dp1[20][30000],dp2[20][30000

hdu 4416 水题 浙大计算机研究生复试上机考试-2005年 可是发现自己写代码有问题

Spring3与Hibernate4整合时出现了nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider. hibernate3的时候,用spring来控制sessionfactory用的可以是org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean,因为用的是hibernate4所以照猫画

HDU-1037-Keep on Truckin&#39;(HDU最水的题没有之一,为了练英语就来吧)

Keep on Truckin' Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10324    Accepted Submission(s): 7147 Problem Description Boudreaux and Thibodeaux are on the road again . . . "Boudreaux, we ha

HDU 4920 水

矩阵乘法 因为答案要MOD3,所以矩阵中会有很多值为0,对这些不乘就行了,,,,,,,这样也能水过... BUT : 这样写会超时: for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) for (int k=1; k<=n; k++) c[i][j]+=a[i][k]*b[k][j]; 这样写就能过: for (int k=1; k<=n; k++) for (int i=1; i<=n; i++) for (int j=1;

HDU 4915 水

'?'可以任意改变成'(' 或者')',问序列有可行解,可行解是否唯一 首先先判断是否有解 判断是否为Many,记录每个位置的左边和右边各需要多少个'('或')' 左边所需'('若正好等于 (i+1)/2,说明若有解则只有唯一解, 右边所需')若正好等于(len-i)/2,说明若有解则只有唯一解, 若均有多解,判断是否相互包含对方 例:((()))变为 (()()): #include "stdio.h" #include "string.h" int a[1000

HDU 4911 水

对于n个数,可以做k次移动,每次移动可以互换相邻位置的两个数,问最少 number of pair (i,j) where 1≤i<j≤n and ai>aj. 如果不移动的话,ans='n个数的逆序对数',移动k次会减少k个 归并排序求逆序对数: #include "stdio.h" #include "string.h" #include "math.h" int b[100010],a[100010],mark[100010];

hdu模版水题目2896

没啥好说的.代码注释,可以秒懂 //照打的.跟模板的差别是引入了used数组和一个flag标记 #include <cstdio> #include <cstring> #include <queue> using namespace std; const int maxn = 510*200; int ch[maxn][128],fail[maxn],end[maxn]; int root,sz,cnt; char str[10010]; bool used[510]

HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 64256    Accepted Submission(s): 18286 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N! Input One N in o

HDU 5053 the Sum of Cube(数学求立方和)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5053 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), whic