From c1b006b65902fa261c0948dde9dd06032affe629 Mon Sep 17 00:00:00 2001 From: oncsr Date: Thu, 20 Mar 2025 16:16:54 +0900 Subject: [PATCH] =?UTF-8?q?[20250320]=20BOJ=20/=20G1=20/=20Lottery=20for?= =?UTF-8?q?=20Vitcoins=20at=20Moloco=20(Hard)=20/=20=EA=B6=8C=ED=98=81?= =?UTF-8?q?=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 Lottery for Vitcoins at Moloco (Hard).md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 khj20006/202503/20 BOJ G1 Lottery for Vitcoins at Moloco (Hard).md diff --git a/khj20006/202503/20 BOJ G1 Lottery for Vitcoins at Moloco (Hard).md b/khj20006/202503/20 BOJ G1 Lottery for Vitcoins at Moloco (Hard).md new file mode 100644 index 00000000..3971588a --- /dev/null +++ b/khj20006/202503/20 BOJ G1 Lottery for Vitcoins at Moloco (Hard).md @@ -0,0 +1,64 @@ +```java + +import java.util.*; +import java.io.*; + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + if(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int N; + static int[][] A; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + A = new int[N][3]; + for(int i=0;i { + int resA = (10000-a[1])*a[0] + (a[0]+b[0])*a[1]; + int resB = (10000-b[1])*b[0] + (a[0]+b[0])*b[1]; + if(resA > resB) return -1; + if(resA < resB) return 1; + return a[2]-b[2]; + }); + for(int[] i:A) bw.write(i[2] + " "); + + } + +} + +```