A. Yet Another Tetris Problem

A. Yet Another Tetris Problem

题意

你有2X1的矩形,这个矩形只能竖放,不能平放,问最后能不能把题目给出的俄罗斯方块变成一个矩形 。

思路

相邻差不能为奇数。

代码实现

#include<bits/stdc++.h>
using namespace std;
int main(void){
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        int a[n];
        bool flag = 0;
        for(int i = 1; i <= n; i++) cin >> a[i];
        for(int i = 1; i <= n-1; i++){
            if(abs(a[i+1]-a[i])%2){
                cout<<"NO"<<endl;
                flag = 1;
                break;
            }
        }
        if(flag==0) cout<<"YES"<<endl;
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/AC-AC/p/12503101.html