文章

5

粉丝

36

获赞

0

访问

923

头像
消消乐 题解:很简单,判断是否同奇同偶就行了
P1869 云南大学机试题
发布于2024年3月13日 22:16
阅读数 129

 

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(void) {
	int t;
	cin >> t;
	
	int a[100];
	for (int i = 0; i < t; i++) {
		int n;
		cin >> n;
		for (int j = 0; j < n; j++) {
			cin >> a[j];
		}

		bool flag = true;
		for (int j = 0; j < n; j++) {
			if (a[j] % 2 != a[0] % 2) {
				flag = false;
				break;
			}
		}

		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发