int main()
{
char bin[6][4]={"BCG","BGC","CBG","CGB","GBC","GCB"};
int binI[6],g1,g2,g3,c1,c2,c3,b1,b2,b3,i,min;
freopen("in.txt","r",stdin);
while(scanf("%d%d%d%d%d%d%d%d%d",&b1,&g1,&c1,&b2,&g2,&c2,&b3,&g3,&c3)!=EOF)
{
min=binI[0]=b2+b3+c1+c3+g1+g2;
binI[1]=b2+b3+c1+c2+g1+g3;
binI[2]=b1+b3+c2+c3+g1+g2;
binI[3]=b1+b2+c2+c3+g1+g3;
binI[4]=b1+b3+c1+c2+g2+g3;
binI[5]=b2+b1+c1+c3+g3+g2;
g1=0;
for(i=0;i<6;i++)
{
if(binI[i] < min)
{
g1=i;
min=binI[i];
}
}
printf("%s %d\n",bin[g1],min);
}
return (0);
}
No comments:
Post a Comment