-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcplay.c
More file actions
61 lines (49 loc) · 1.33 KB
/
cplay.c
File metadata and controls
61 lines (49 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdio.h>
int main(){
char a[100000];
int x,count,count_a,count_b;
while(scanf("%s",a)==1)
{
count=0;
count_a=0;
count_b=0;
for(x=0;x<20;x++)
{
if (x%2==0){
if (a[x]=='1')
count_a+=1;}
else{
if(a[x]=='1')
count_b+=1;}
// printf("shoot %d = count A = %d count B = %d \n",count,count_a,count_b);
count = x+1;
if ((x==5) && (count_a-count_b>=3 || count_b-count_a>=3 ))
{
break;}
else if ((x==6) && ( count_a-count_b>=3 || count_b-count_a>=2 ))
{
break; }
else if ((x==7) && ( count_a-count_b>=2 || count_b-count_a>=2 ))
{
break; }
else if ((x==8) && ( count_a-count_b>1 || count_b-count_a>=1 ))
{
break; }
else if ((x==9) && ( count_a-count_b>0 || count_b-count_a>0 ))
{
break;}
else if ((x>=10) && (x%2==1) && ( count_a-count_b>=1 || count_b-count_a>=1 ) )
{
break;}
}
if(count_a>count_b)
{
printf("TEAM-A %d\n", count);
}
else if (count_b>count_a)
printf("TEAM-B %d\n", count);
else
printf("TIE\n");
}
return 0;
}