From 865892122bdbb9c7dad23b2a76ef3cca852ae07f Mon Sep 17 00:00:00 2001 From: rl544 <111494264+rl544@users.noreply.github.com> Date: Sun, 25 Dec 2022 01:54:37 +0900 Subject: [PATCH] =?UTF-8?q?uploaded=20at=202022.=2012.=2025.=20=EC=98=A4?= =?UTF-8?q?=EC=A0=84=201:54:37?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- programmers/예상 대진표/solution.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 programmers/예상 대진표/solution.java diff --git a/programmers/예상 대진표/solution.java b/programmers/예상 대진표/solution.java new file mode 100644 index 0000000..66af5f9 --- /dev/null +++ b/programmers/예상 대진표/solution.java @@ -0,0 +1,24 @@ +// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/12985 + +class Solution +{ + static double baseLog(double x, double base) { + return Math.log10(x) / Math.log10(base); + } + private int next(int a){ + return (a+1)/2; + } + public int solution(int n, int a, int b) + { + int answer = 0; + System.out.println(a+" "+b); + for(int c = 1; c<= baseLog(n,2); c++){ + answer = c; + System.out.println(a+" "+b); + if((int)Math.abs(a-b)==1 && Math.min(a,b)%2==1) break; + a = next(a); + b = next(b); + } + return answer; + } +} \ No newline at end of file