From 0fc486df73968295800637b06a1317237d920ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=88=98=EB=AF=BC?= Date: Thu, 17 Oct 2024 21:17:55 +0900 Subject: [PATCH] CT_284 --- ...\352\263\204\354\240\204\354\237\201.java" | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 "BOJ/Java/src/B3/Boj_4435_\354\244\221\352\260\204\352\263\204\354\240\204\354\237\201.java" diff --git "a/BOJ/Java/src/B3/Boj_4435_\354\244\221\352\260\204\352\263\204\354\240\204\354\237\201.java" "b/BOJ/Java/src/B3/Boj_4435_\354\244\221\352\260\204\352\263\204\354\240\204\354\237\201.java" new file mode 100644 index 00000000..cc048655 --- /dev/null +++ "b/BOJ/Java/src/B3/Boj_4435_\354\244\221\352\260\204\352\263\204\354\240\204\354\237\201.java" @@ -0,0 +1,49 @@ +package B3; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.StringTokenizer; + +public class Boj_4435_중간계전쟁 { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringBuilder sb = new StringBuilder(); + + final int[] gandalp = {1, 2, 3, 3, 4, 10}; + final int[] saouron = {1, 2, 2, 2, 3, 5, 10}; + + int T = Integer.parseInt(br.readLine()); + + for (int t = 1; t <= T; t++) { + StringTokenizer st = new StringTokenizer(br.readLine()); + int sum1 = 0; + int sum2 = 0; + + for (int i : gandalp) { + sum1 += i * Integer.parseInt(st.nextToken()); + } + + st = new StringTokenizer(br.readLine()); + for (int i : saouron) { + sum2 += i * Integer.parseInt(st.nextToken()); + } + + sb.append("Battle ").append(t).append(": "); + + if (sum1 > sum2) { + sb.append("Good triumphs over Evil\n"); + } else if (sum1 < sum2) { + sb.append("Evil eradicates all trace of Good\n"); + } else { + sb.append("No victor on this battle field\n"); + } + } + + bw.write(sb.toString()); + bw.flush(); + } +}