https://codeforces.com/gym/323862/problem/D
選擇一個減小1,其他的都增加1,可以看做其他是不變的,而這個數減小了2,所以必須奇偶性相同
#include<bits/stdc++.h>
#include <iostream>
#include<algorithm>
using namespace std;
const int maxn = 1e5+10;
int n,a[maxn];
int main()
{
ios::sync_with_stdio(0);
int t;
cin>>t;
while (t--){
cin>>n;
for(int i = 1;i <= n;++i)
cin>>a[i];
bool flag = 0;
sort(a+1,a+1+n);
for(int i = 1;i < n;++i)
{
int k = a[i+1]- a[i];
if(k%2 == 1)
{
flag = 1;
break;
}
}
if(!flag) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/277701.html
標籤:其他
上一篇:SpringMVC原理剖析
下一篇:Vue的路由守衛
