标签:
链接http://acm.swust.edu.cn/problem/489/
#include <stdio.h> int main() { int m,n; int temp,i,j; int sum_1,sum_2; int a[100005]; while(scanf("%d%d",&m,&n)!=EOF) { if(m>n) { temp=m; m=n; n=temp; } for(i=m;i<=n;i++) { a[i]=i; } sum_1=sum_2=0; for(i=m;i<=n;i++) { if(a[i]%2==0) { sum_1=sum_1+a[i]*a[i]; } else { sum_2=sum_2+a[i]*a[i]*a[i]; } } printf("%d %d\n",sum_1,sum_2); } return 0; }
标签:
原文地址:http://www.cnblogs.com/niconiconi/p/5724007.html