题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5053
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<map> #include<queue> #include<cmath> #include<stack> #include<set> #include<vector> #include<algorithm> #define LL __int64 #define inf 1<<29 #define s(a) scanf("%d",&a) #define CL(a,b) memset(a,b,sizeof(a)) using namespace std; const int N=200005; int n,m,a,b,c; int main() { int t,Case=1; s(t); while(t--){ LL sum=0,a,b; scanf("%I64d%I64d",&a,&b); for(LL i=a;i<=b;i++) sum+=i*i*i; printf("Case #%d: %I64d\n",Case++,sum); } return 0; }