import java.io.*;
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class Main{
public static void main(String[] args) throws FileNotFoundException, IOException {
TextIO.readStream(System.in);
while(true){
int x=0;
try{
x=TextIO.getInt();
}catch(Exception e){
break;
}
int []brown=new int[3];
int []green=new int[3];
int []clear=new int[3];
brown[0]=x;
for(int i=0;i<3;i++){
if(i!=0){
brown[i]=TextIO.getInt();
}
green[i]=TextIO.getInt();
clear[i]=TextIO.getInt();
}
long min=Long.MAX_VALUE;
String val="";
long temp=brown[1]+brown[2]+clear[0]+clear[2]+green[0]+green[1];
if(temp<min){
min=temp;
val="BCG";
}
temp=brown[1]+brown[2]+green[0]+green[2]+clear[0]+clear[1];
if(temp<min){
min=temp;
val="BGC";
}
temp=brown[0]+brown[2]+green[0]+green[1]+clear[1]+clear[2];
if(temp<min){
min=temp;
val="CBG";
}
temp=brown[0]+brown[1]+green[0]+green[2]+clear[1]+clear[2];
if(temp<min){
min=temp;
val="CGB";
}
temp=brown[0]+brown[2]+green[1]+green[2]+clear[0]+clear[1];
if(temp<min){
min=temp;
val="GBC";
}
temp=brown[0]+brown[1]+green[1]+green[2]+clear[0]+clear[2];
if(temp<min){
min=temp;
val="GCB";
}
System.out.println(val+" "+min);
}
}
}
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class Main{
public static void main(String[] args) throws FileNotFoundException, IOException {
TextIO.readStream(System.in);
while(true){
int x=0;
try{
x=TextIO.getInt();
}catch(Exception e){
break;
}
int []brown=new int[3];
int []green=new int[3];
int []clear=new int[3];
brown[0]=x;
for(int i=0;i<3;i++){
if(i!=0){
brown[i]=TextIO.getInt();
}
green[i]=TextIO.getInt();
clear[i]=TextIO.getInt();
}
long min=Long.MAX_VALUE;
String val="";
long temp=brown[1]+brown[2]+clear[0]+clear[2]+green[0]+green[1];
if(temp<min){
min=temp;
val="BCG";
}
temp=brown[1]+brown[2]+green[0]+green[2]+clear[0]+clear[1];
if(temp<min){
min=temp;
val="BGC";
}
temp=brown[0]+brown[2]+green[0]+green[1]+clear[1]+clear[2];
if(temp<min){
min=temp;
val="CBG";
}
temp=brown[0]+brown[1]+green[0]+green[2]+clear[1]+clear[2];
if(temp<min){
min=temp;
val="CGB";
}
temp=brown[0]+brown[2]+green[1]+green[2]+clear[0]+clear[1];
if(temp<min){
min=temp;
val="GBC";
}
temp=brown[0]+brown[1]+green[1]+green[2]+clear[0]+clear[2];
if(temp<min){
min=temp;
val="GCB";
}
System.out.println(val+" "+min);
}
}
}
No comments:
Post a Comment