/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package uva100;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int b1b, b1g, b1c, b2b, b2g, b2c, b3b, b3g, b3c;
int bgc, bcg, gbc, gcb, cbg, cgb;
int minimum;
String comb;
while(scanner.hasNextInt()) {
b1b = scanner.nextInt();
b1g = scanner.nextInt();
b1c = scanner.nextInt();
b2b = scanner.nextInt();
b2g = scanner.nextInt();
b2c = scanner.nextInt();
b3b = scanner.nextInt();
b3g = scanner.nextInt();
b3c = scanner.nextInt();
bcg = b2b + b3b + b1c + b3c + b1g + b2g;
bgc = b2b + b3b + b1c + b2c + b1g + b3g;
gbc = b1b + b3b + b1c + b2c + b3g + b2g;
gcb = b1b + b2b + b1c + b3c + b3g + b2g;
cbg = b1b + b3b + b2c + b3c + b1g + b2g;
cgb = b1b + b2b + b2c + b3c + b3g + b1g;
minimum = bcg;
comb = "BCG";
if (bgc < minimum) {
minimum = bgc;
comb = "BGC";
}
if (cbg < minimum) {
minimum = cbg;
comb = "CBG";
}
if (cgb < minimum) {
minimum = cgb;
comb = "CGB";
}
if (gbc < minimum) {
minimum = gbc;
comb = "GBC";
}
if (gcb < minimum) {
minimum = gcb;
comb = "GCB";
}
System.out.println(comb + " "+minimum);
}
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package uva100;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int b1b, b1g, b1c, b2b, b2g, b2c, b3b, b3g, b3c;
int bgc, bcg, gbc, gcb, cbg, cgb;
int minimum;
String comb;
while(scanner.hasNextInt()) {
b1b = scanner.nextInt();
b1g = scanner.nextInt();
b1c = scanner.nextInt();
b2b = scanner.nextInt();
b2g = scanner.nextInt();
b2c = scanner.nextInt();
b3b = scanner.nextInt();
b3g = scanner.nextInt();
b3c = scanner.nextInt();
bcg = b2b + b3b + b1c + b3c + b1g + b2g;
bgc = b2b + b3b + b1c + b2c + b1g + b3g;
gbc = b1b + b3b + b1c + b2c + b3g + b2g;
gcb = b1b + b2b + b1c + b3c + b3g + b2g;
cbg = b1b + b3b + b2c + b3c + b1g + b2g;
cgb = b1b + b2b + b2c + b3c + b3g + b1g;
minimum = bcg;
comb = "BCG";
if (bgc < minimum) {
minimum = bgc;
comb = "BGC";
}
if (cbg < minimum) {
minimum = cbg;
comb = "CBG";
}
if (cgb < minimum) {
minimum = cgb;
comb = "CGB";
}
if (gbc < minimum) {
minimum = gbc;
comb = "GBC";
}
if (gcb < minimum) {
minimum = gcb;
comb = "GCB";
}
System.out.println(comb + " "+minimum);
}
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন