文章

43

粉丝

180

获赞

21

访问

179.9k

头像
c++
P1212 中南大学机试题
发布于2022年4月26日 16:57
阅读数 3.1k

#include <iostream>

using namespace std;

int x, y;

int main()
{
	while (cin >> x >> y)
	{
		int odd = 0, eve = 0;
		if (x > y) swap(x, y);
		for (int i = x; i <= y; i ++ )
			if (i % 2) odd += i * i * i;
			else eve += i * i;
		cout << eve << ' ' << odd << endl;
	}
	return 0;
}

 

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发