From 367459b01591aa11e6eca4fe872f84dc453376d7 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Tue, 9 Dec 2025 15:32:48 +0900 Subject: [PATCH] =?UTF-8?q?[20251209]=20BOJ=20/=20G5=20/=20=EB=88=84?= =?UTF-8?q?=EA=B0=80=20=EC=9D=B4=EA=B8=B8=EA=B9=8C=20/=20=EC=9D=B4?= =?UTF-8?q?=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 \354\235\264\352\270\270\352\271\214.md" | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 "0224LJH/202512/09 BOJ \353\210\204\352\260\200 \354\235\264\352\270\270\352\271\214.md" diff --git "a/0224LJH/202512/09 BOJ \353\210\204\352\260\200 \354\235\264\352\270\270\352\271\214.md" "b/0224LJH/202512/09 BOJ \353\210\204\352\260\200 \354\235\264\352\270\270\352\271\214.md" new file mode 100644 index 00000000..ee461b4d --- /dev/null +++ "b/0224LJH/202512/09 BOJ \353\210\204\352\260\200 \354\235\264\352\270\270\352\271\214.md" @@ -0,0 +1,64 @@ +```java + +import java.util.StringTokenizer; +import java.util.*; +import java.io.*; + +public class Main { + + static int[] total = new int[2]; + static long[][] people = new long[2][100001]; + static long[][] cumul = new long[2][100001]; + static long win,lose,draw; + + public static void main(String[] args) throws IOException { + init(); + process(); + print(); + + } + + private static void init() throws IOException{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + total[0] = Integer.parseInt(st.nextToken()); + total[1] = Integer.parseInt(st.nextToken()); + win = 0; + lose = 0; + draw = 0; + + for (int i = 0 ; i < 2; i++) { + st = new StringTokenizer(br.readLine()); + + for (int j = 0; j < total[i]; j++) { + int num = Integer.parseInt(st.nextToken()); + people[i][num]++; + } + } + + + + } + + private static void process() throws IOException { + for (int i = 1; i<= 100000; i++) { + for (int j = 0; j < 2; j++) { + cumul[j][i] = cumul[j][i-1] + people[j][i]; + } + } + + for (int i = 1; i <= 100000; i++) { + win += people[0][i] * (cumul[1][i-1]); + lose += people[1][i] * (cumul[0][i-1]); + draw += people[0][i] * people[1][i]; + } + + + } + + private static void print() { + System.out.println(win + " "+ lose +" " + draw); + } + +} +```