Hakase and Nano HDU - 6266 (博弈+思维)

http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf

 1 #include <stdio.h>
 2 #include <string.h>
 3 
 4 int a[1000005];
 5 
 6 int main()
 7 {
 8     int t, i, n, d, x;
 9     scanf("%d", &t);
10     while(t--)
11     {
12         x = 0;
13         scanf("%d %d", &n, &d);
14         for(i=0; i<n; i++)
15         {
16             scanf("%d", &a[i]);
17             if(a[i]==1) x++;
18         }
19         if(d==1)
20         {
21             if(n%3==0&&x==n) printf("No\n");
22             else printf("Yes\n");
23         }
24         else
25         {
26             if((x==n&&n%3==1) || (x==n-1&&n%3==1) || (x==n-1&&n%3==0))
27                 printf("No\n");
28             else printf("Yes\n");
29         }
30     }
31     return 0;
32 }

 

posted @ 2019-10-24 01:25  Xxiaoyu  阅读(145)  评论(0编辑  收藏  举报