Skip to content

Instantly share code, notes, and snippets.

@niklasjang
Created August 23, 2020 16:09
Show Gist options
  • Save niklasjang/9279831bc1419cdd16b9ecb73598c249 to your computer and use it in GitHub Desktop.
Save niklasjang/9279831bc1419cdd16b9ecb73598c249 to your computer and use it in GitHub Desktop.
[PS][java][Brute-Force]/[토너먼트]
import javax.sound.midi.SysexMessage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main{
static int n,a,b;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.parseInt(st.nextToken());
a = Integer.parseInt(st.nextToken());
b = Integer.parseInt(st.nextToken());
int ans = 0;
while(a!=b){
a -= a/2;
b -= b/2;
ans++;
}
System.out.println(ans);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment