题目:http://acm.hdu.edu.cn/showproblem.php?pid=2007
仅供参考:
#include<stdio.h>
#include<math.h>
int main()
{
int m, n;
while (scanf("%d%d", &m, &n) != EOF)
{
int x = 0, y = 0;
if (m > n)
{
int t;
t = m;
m = n;
n = t;
}
for (; m <= n; m++)
{
if (m % 2 == 0)
x += pow(m,2);//pow(x,y)表示x^y,须引用<math.h>
else
y +=pow(m,3);
}
printf("%d %d\n", x, y);
}
return 0;
}