【水题】HDU 5053 the Sum of Cube
求以边长[A,B](闭区间) 的立方体的体积和
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <string> #include <iostream> #include <algorithm> #include <sstream> #include <cmath> using namespace std; #include <queue> #include <stack> #include <vector> #include <deque> #include <set> #include <map> #include <time.h>; #define cler(arr, val) memset(arr, val, sizeof(arr)) #define IN freopen ("in.txt" , "r" , stdin); #define OUT freopen ("out.txt" , "w" , stdout); typedef long long LL; const int MAXN = 710;//点数的最大值 const int MAXM = 200006;//边数的最大值 const int INF = 0x3f3f3f3f; const int mod = 10000007; const int N=102010; int main() { int t,cas=1; cin>>t; while(t--) { LL sum=0,a,b; cin>>a>>b; for(LL i=a;i<=b;i++) sum+=i*i*i; printf("Case #%d: ",cas++); cout<<sum<<endl; } }