HDU 4696 Answers (2013多校10,1001题 )
Answers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 25 Accepted Submission(s): 16
Problem Description
Sample Input
2 4
2 2
2 1
0 1 2 3
Sample Output
NO
YES
YES
YES
Source
Recommend
zhuyuanchen520
分容易发现规律。
如果M<=0 肯定不行。
如果没有1,只能弄出偶数。
其余都可以
1 /* *********************************************** 2 Author :kuangbin 3 Created Time :2013/8/22 13:25:04 4 File Name :F:\2013ACM练习\2013多校10\1001.cpp 5 ************************************************ */ 6 7 #include <stdio.h> 8 #include <string.h> 9 #include <iostream> 10 #include <algorithm> 11 #include <vector> 12 #include <queue> 13 #include <set> 14 #include <map> 15 #include <string> 16 #include <math.h> 17 #include <stdlib.h> 18 #include <time.h> 19 using namespace std; 20 const int MAXN = 100010; 21 int T[MAXN],C[MAXN]; 22 int M; 23 int main() 24 { 25 //freopen("in.txt","r",stdin); 26 //freopen("out.txt","w",stdout); 27 int N,Q; 28 while(scanf("%d%d",&N,&Q) == 2) 29 { 30 for(int i = 1;i <= N;i++) 31 scanf("%d",&T[i]); 32 bool flag = false; 33 for(int i = 1;i <= N;i++) 34 { 35 scanf("%d",&C[i]); 36 if(C[i] == 1) 37 flag = true; 38 } 39 while(Q--) 40 { 41 scanf("%d",&M); 42 if(M <= 0) 43 printf("NO\n"); 44 else 45 { 46 if(flag)printf("YES\n"); 47 else if(M%2)printf("NO\n"); 48 else printf("YES\n"); 49 } 50 } 51 } 52 return 0; 53 }
人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想