随笔 - 6, 文章 - 0, 评论 - 3, 引用 - 0
数据加载中……

UVA_102

 1 #include <vector>
 2 #include <list>
 3 #include <map>
 4 #include <set>
 5 #include <deque>
 6 #include <queue>
 7 #include <stack>
 8 #include <bitset>
 9 #include <algorithm>
10 #include <functional>
11 #include <numeric>
12 #include <utility>
13 #include <sstream>
14 #include <iostream>
15 #include <iomanip>
16 #include <cstdio>
17 #include <cmath>
18 #include <cstdlib>
19 #include <cctype>
20 #include <string>
21 #include <cstring>
22 #include <cstdio>
23 #include <cmath>
24 #include <cstdlib>
25 #include <ctime>
26 
27 using namespace std;
28 
29 int main(){
30     int b1[3],b2[3],b3[3];
31     char c[]="BGC";
32     while(cin>>b1[0]>>b1[1]>>b1[2]>>b2[0]>>b2[1]>>b2[2]>>b3[0]>>b3[1]>>b3[2]){
33     string s="zzzzzzz";
34     int Min=2000000000;
35     for(int i=0;i<3;i++){
36         for(int j=0;j<3;j++){
37             if(i!=j){
38                 for(int k=0;k<3;k++){
39                     if(k!=i&&k!=j){
40                         string t="";
41                         t+=c[i];
42                         t+=c[j];
43                         t+=c[k];
44                         int s1=b2[i]+b3[i];
45                         int s2=b1[j]+b3[j];
46                         int s3=b1[k]+b2[k];
47 
48                         if(s1+s2+s3<Min){
49                             Min=s1+s2+s3;
50                             s=t;
51                         }
52                         else if(s1+s2+s3==Min){
53                             if(t<s){
54                                 s=t;
55                             }
56                         }
57                     }
58                 }
59             }
60         }
61     }
62     cout<<s<<" "<<Min<<endl;
63     }
64     return 0;
65 }
66 

posted on 2008-10-07 23:51 水牛♂Toto 阅读(257) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理