PKU-P1063代码

#include<iostream>
#include<math.h>

using namespace std;
int main()
{
 int n;
 cin>>n;
 for(int k=1;k<=n;k++)
 {
  int m,s[101],i,ji=0,ou=0;
  cin>>m;
  if(m%2>0)
        {
          for(i=1;i<=m;i++)
            cin>>s[i];
          cout<<"YES\n";
        }
  else
  {
   for(i=1;i<=m;i++)
   {
    cin>>s[i];
    if(s[i]==0 && i%2>0)ji++;
    if(s[i]==0 && i%2==0)ou++;
   }
  if(abs(ji-ou)<2)
     cout<<"YES\n";
  else 
     cout<<"NO\n";
  }
 }
// system("pause");
 return 0;
}
 

发表评论

注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)

本文链接:https://twd2.me/archives/23QrCode