题目:http://acm.hdu.edu.cn/showproblem.php?pid=2007
#include <stdio.h>
int main(){
int n,m,k,d,temp;
while(scanf("%d%d", &n,&m) != EOF)
{
k=0;
d=0;
if(n>m)
{
temp=m;
m=n;
n=temp;
}
for(;n<=m;n++)
{
if(n%2!=0)
k+=n*n*n; //使用pow()函数超时
else
d+=n*n;
}
printf("%d %d\n",d,k);
}
return 0;
}