From 0c45fe78d81d101c4911efa6bdd149b2740fc7c4 Mon Sep 17 00:00:00 2001 From: rl544 <111494264+rl544@users.noreply.github.com> Date: Sun, 25 Dec 2022 01:55:31 +0900 Subject: [PATCH] =?UTF-8?q?updated=20at=202022.=2012.=2025.=20=EC=98=A4?= =?UTF-8?q?=EC=A0=84=201:55:30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- programmers/예상 대진표/solution.java | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/programmers/예상 대진표/solution.java b/programmers/예상 대진표/solution.java index 66af5f9..24479ed 100644 --- a/programmers/예상 대진표/solution.java +++ b/programmers/예상 대진표/solution.java @@ -1,24 +1,7 @@ // [문제 링크]: 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; +class Solution{ + public int solution(int n, int a, int b){ + return Integer.toBinaryString((a-1)^(b-1)).length(); } } \ No newline at end of file