A - Yet Another Tetris Problem
Thinking: interpretation bunch of odd and even numbers are not the same, write a function that loops through, and then determine whether the same odd and even.
Code:
#include<iostream> using namespace std; int a[1005]; int fun(int n){ int i; for (int i = 0; i < n; i++){ if (a[i] % 2 != a[0] % 2) return 0; } return 1; } int main(){ int n; cin >> n; while (n--){ int x; cin >> x; for (int i = 0; i < x; i++) cin >> a[i]; if (fun(x) == 1) cout << "YES" << endl; else cout << "NO" << endl; } system("pause"); return 0; }