~cpp
//2. 활
//
//--->활 통 한. total .
//---> 활 통 합
// 큰 합 . max()함 통해 .
#include<iostream>
using namespace std;
int container[9]; // .
int total=0; // .
int ch_number; // 횟 한.
char bgc[3]={'B','G','C'};
char save[4]={"NNN"}; //
int max(int* array);
void main()
{
cout<<" "<<endl;
for(int i=0 ; i<9 ; i++)
{
cin>>container[i];
total+=container[i];
}
ch_number = total - max(container);
cout<<endl;
cout<<save<<" "<<ch_number;
cout<<endl;
}
int max(int* array)
{
int temp=0;// 합 한 한.
int max=0; // 합 해 큰 한.
for(int i=0 ; i<3 ; i++)
{
for(int j=3 ; j<6 ; j++)
{
if(j%3 == i)
continue;
else
{
temp+=array[i];
temp+=array[j];
temp+=array[12-(i+j)];
}
if(temp > max)
{
max=temp;
save[0]=bgc[i];
save[1]=bgc[(j%3)];
save[2]=bgc[3-((j%3)+i)];
}
temp=0;
}
}
return max;
}