Codeforces Gym101473 A.Zero or One (2013-2014 ACM-ICPC Brazil Subregional Programming Contest)
代码:
1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<cmath> 5 #include<algorithm> 6 using namespace std; 7 int main(){ 8 int a,b,c; 9 int sum; 10 while(~scanf("%d%d%d",&a,&b,&c)){ 11 sum=0; 12 if(a==0)sum++; 13 if(b==0)sum++; 14 if(c==0)sum++; 15 if(sum==3||sum==0)printf("*\n"); 16 if(sum==1){ 17 if(a==0)printf("A\n"); 18 else if(b==0)printf("B\n"); 19 else if(c==0)printf("C\n"); 20 } 21 if(sum==2){ 22 if(a==1)printf("A\n"); 23 else if(b==1)printf("B\n"); 24 else if(c==1)printf("C\n"); 25 } 26 } 27 return 0; 28 }