Problem : 2007 ( 平方和与立方和 ) Judge Status : Accepted
RunId : 5995727 Language : C Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
RunId : 5995727 Language : C Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
1 #include <stdio.h> 2 int main() 3 { 4 int l,r,r1,r2,m,n; 5 while (scanf("%d%d",&m,&n)!=EOF) 6 { 7 //要比较m、n的大小 8 l=m<n?m:n; 9 r=m<n?n:m; 10 r1=0; 11 r2=0; 12 while (l<=r) 13 { 14 if(l%2==0) 15 r2+=(l*l); 16 else 17 r1+=(l*l*l); 18 l++; 19 } 20 printf("%d %d\n",r2,r1); 21 } 22 return 0; 23 }