HDOJ 4696 Answers 乱搞


乱搞:

rt,有1就能输出所有的数,否则只能输出偶数

Answers

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 489    Accepted Submission(s): 294


Problem Description
HDOJ 4696 Answers 乱搞_第1张图片
 

Sample Input
   
   
   
   
2 4 2 2 2 1 0 1 2 3
 

Sample Output
   
   
   
   
NO YES YES YES
 

Source
2013 Multi-University Training Contest 10
 



#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int n,m;
int t[100100],c[100100];

int main()
{
  while(scanf("%d%d",&n,&m)!=EOF)
    {
      bool flag=false;
      for(int i=1;i<=n;i++)
        scanf("%d",t+i);
      for(int i=1;i<=n;i++)
        {
          scanf("%d",c+i);
          if(c[i]==1) flag=true;
        }
      for(int i=0;i<m;i++)
        {
          int x;
          scanf("%d",&x);
          if(x<=0) puts("NO");
          else
            {
              if(flag) puts("YES");
              else
                {
                  if(x%2==0) puts("YES");
                  else puts("NO");
                }
            }
        }
    }
  return 0;
}



你可能感兴趣的:(HDOJ 4696 Answers 乱搞)