90求助!
查看原帖
90求助!
1399141
longxiewen11楼主2025/1/19 14:44
#include <iostream>
using namespace std;
long long n, a[1001], d, e, f;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		d++;
		if (a[i] == 0) {
			break;
		}
	}
	if (d % 2 == 0) {
		cout << "YES";
	} else {
		for (int i = n - 1; i >= 0; i--) {
			e++;
			if (a[i] == 0) {
				break;
			}
		}
		if (e % 2 == 0) {
			cout << "YES";
		} else {
			cout << "NO";
		}
	}
	return 0;
}
2025/1/19 14:44
加载中...