

import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int B = sc.nextInt();
String result = "";
while(N > 0) {
if(N%B >= 10)
result += (char)((N%B)-10+'A');
else
result += (char)((N%B)+'0');
N=N/B;
}
for (int i = result.length() - 1; i >= 0; i--) {
System.out.print(result.charAt(i));
}
sc.close();
}
}
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준_JAVA] 2292 벌집 (1) | 2023.08.30 |
---|---|
[백준_JAVA] 2903 중앙 이동 알고리즘 (0) | 2023.08.29 |
[백준_JAVA] 1157 단어 공부 (0) | 2023.08.27 |
[백준_JAVA] 2720 세탁소 사장 동혁 (0) | 2023.08.18 |
[백준_JAVA] 2501 약수 구하기 (0) | 2023.08.17 |