标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 552 Accepted Submission(s): 193
1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 #define MAX(x,y) x>y?x:y 5 #define MIN(x,y) x<y?x:y 6 int judge(int x,int y){ 7 int a,b; 8 a=MAX(x,y); 9 b=MIN(x,y); 10 if((a-b)%3==0)return a; 11 else return 0; 12 } 13 int main(){ 14 int Y,B,R,temp[3],flot; 15 while(~scanf("%d%d%d",&Y,&B,&R)){flot=1; 16 temp[0]=judge(Y,B),temp[1]=judge(Y,R),temp[2]=judge(B,R); 17 sort(temp,temp+3); 18 for(int i=0;i<3;i++){ 19 if(temp[i]){flot=0; 20 printf("%d\n",temp[i]);break; 21 } 22 } 23 if(flot)printf("):\n"); 24 } 25 return 0; 26 }
标签:
原文地址:http://www.cnblogs.com/handsomecui/p/4676406.html