标签:for std swap span log 偶数 define iostream include
http://acm.hdu.edu.cn/showproblem.php?pid=2007
#include<iostream> #include<stdio.h> #include<math.h> #include<queue> #include<stack> #include<algorithm> #define PI 3.1415927 using namespace std; int main() { int m,n,i; while(~scanf("%d%d",&m,&n)) { int s1=0,s2=0; if(m>n) { swap(m,n);//容易遗漏 } for(i=m;i<=n;i++) { if(i%2==0)//判断偶数 { s1+=i*i; } else { s2+=i*i*i; } } printf("%d %d\n",s1,s2); } return 0; }
标签:for std swap span log 偶数 define iostream include
原文地址:http://www.cnblogs.com/hhkobeww/p/7466536.html