标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 564 Accepted Submission(s):
198
1 #include <stdio.h> 2 #include <math.h> 3 #include <algorithm> 4 #define max(a,b) a>b?a:b 5 using namespace std; 6 int main() 7 { 8 9 int a, b, c; 10 int i, total; 11 12 while(~scanf("%d %d %d", &a, &b, &c)) 13 { 14 total = 0; 15 int num[3] = {0, 0, 0}; 16 if(abs(a-b)%3==0) 17 num[total] += max(a,b); 18 total++; 19 if(abs(b-c)%3==0) 20 num[total] += max(b,c); 21 total++; 22 if(abs(a-c)%3==0) 23 num[total] += max(a,c); 24 total++; 25 if(num[0]==0 && num[1]==0 && num[2]==0) 26 printf("):\n"); 27 else 28 { 29 sort(num, num+3); 30 for(i=0; i<3; i++) 31 { 32 if(num[i] != 0) 33 { 34 printf("%d\n",num[i]); 35 break; 36 } 37 } 38 } 39 } 40 return 0; 41 }
标签:
原文地址:http://www.cnblogs.com/fengshun/p/4677421.html