반응형
1031번
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int octNum = Integer.parseInt(br.readLine());
System.out.println(Integer.toOctalString(octNum));
}
}
1032번
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int hexNum = Integer.parseInt(br.readLine());
System.out.println(Integer.toHexString(hexNum));
}
}
1033번
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int hexNum = Integer.parseInt(br.readLine());
System.out.println(Integer.toHexString(hexNum).toUpperCase());
}
}
1034번
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String octNum = br.readLine();
System.out.println(Integer.valueOf(octNum, 8));
}
}
1035번
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String hexNum = br.readLine();
int decNum = Integer.valueOf(hexNum, 16);
String octNum = Integer.toOctalString(decNum);
System.out.println(octNum);
}
}
반응형
'알고리즘 > 코드업 기초 100제' 카테고리의 다른 글
[JAVA]코드업 1041번 ~ 1045번 (0) | 2021.04.30 |
---|---|
[JAVA]코드업 1036번 ~ 1040번 (0) | 2021.04.29 |
[JAVA]코드업 1026번 ~ 1030번 (0) | 2021.04.29 |
[JAVA]코드업 1021번 ~ 1025번 (0) | 2021.04.27 |
[JAVA]코드업 1016번 ~ 1020번 (0) | 2021.04.27 |