//uva-100
//Md.Asaduzzaman
//MBSTU(IT-14053)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int b1,g1,c1,b2,g2,c2,b3,g3,c3,i,a[6],min;
while(cin>>b1>>g1>>c1>>b2>>g2>>c2>>b3>>g3>>c3)
{
a[0]=b2+b3+c1+c3+g1+g2;
a[1]=b2+b3+c1+c2+g1+g3;
a[2]=b1+b3+c2+c3+g1+g2;
a[3]=b1+b2+c2+c3+g1+g3;
a[4]=b1+b3+c1+c2+g3+g2;
a[5]=b2+b1+c1+c3+g3+g2;
for(i=0;i<6;i++)
{
if(i==0) min=a[i];
else if(min>a[i]) min=a[i];
}
for(i=0;i<6;i++)
{
if(a[i]==min) {
if(i==0) cout<<"BCG ";
else if(i==1) cout<<"BGC ";
else if(i==2) cout<<"CBG ";
else if(i==3) cout<<"CGB ";
else if(i==4) cout<<"GBC ";
else if(i==5) cout<<"GCB ";
cout<<a[i]<<endl;
break;
}
}
}
return 0;
}
//Md.Asaduzzaman
//MBSTU(IT-14053)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int b1,g1,c1,b2,g2,c2,b3,g3,c3,i,a[6],min;
while(cin>>b1>>g1>>c1>>b2>>g2>>c2>>b3>>g3>>c3)
{
a[0]=b2+b3+c1+c3+g1+g2;
a[1]=b2+b3+c1+c2+g1+g3;
a[2]=b1+b3+c2+c3+g1+g2;
a[3]=b1+b2+c2+c3+g1+g3;
a[4]=b1+b3+c1+c2+g3+g2;
a[5]=b2+b1+c1+c3+g3+g2;
for(i=0;i<6;i++)
{
if(i==0) min=a[i];
else if(min>a[i]) min=a[i];
}
for(i=0;i<6;i++)
{
if(a[i]==min) {
if(i==0) cout<<"BCG ";
else if(i==1) cout<<"BGC ";
else if(i==2) cout<<"CBG ";
else if(i==3) cout<<"CGB ";
else if(i==4) cout<<"GBC ";
else if(i==5) cout<<"GCB ";
cout<<a[i]<<endl;
break;
}
}
}
return 0;
}
No comments:
Post a Comment