杭电OJ2007

#include <iostream>
using namespace std;
int main()
{
	int x, y;
	while (cin >> x >> y)
	{   
		int m = 0, n = 0,temp;
		if (y>x)
		{
			temp = x;
			x = y;
			y = temp;
			
		}
			int  j;
			for (j = y; j <= x; j++)
			{
				if (j % 2 == 0)
					m = m + j*j;
				else
					n = n + j*j*j;
		}
		cout << m << " " << n << endl;
	}
}

猜你喜欢

转载自blog.csdn.net/weixin_42265486/article/details/83582602