【杭电5053】the Sum of Cube

来源:互联网 发布:全球云计算大会 上海 编辑:程序博客网 时间:2024/05/15 04:19

这里写图片描述
暂且算简单题目吧,有点暴力-_-
用__int 64就行了

#include<stdio.h>int main(){    int n,k=0;    scanf("%d",&n);    while(n--){        int i,j;        __int64 sum=0,l;        scanf("%d %d",&i,&j);        for(l=i;l<=j;l++){            sum=sum+l*l*l;        }        printf("Case #%d: %I64d\n",++k,sum);    }    return 0;}

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

0 0