728x90
반응형
2024.08.01기준 - 브론즈2
728x90
백준, BEAKJOON, BOJ, JAVA, 자바
풀이
이 문제는 주어진 자연수를 이진수로 표현하는 문제입니다.
이 문제는 간단하게 자연수 N의 범위인 100,000,000,000,000만 신경써서 long으로 변수타입을 잡고 이진수로 출력해주면 되는 간단한 문제입니다.
코드
package Main;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
long n = Long.parseLong(br.readLine());
// 자연수를 2진수로 출력한다.
bw.write(Long.toString(n, 2));
bw.flush();
bw.close();
br.close();
}
}
728x90
반응형
'코딩테스트 일기 (BAEKJOON)' 카테고리의 다른 글
BEAKJOON / 백준 - JAVA 13268번 셔틀런 (0) | 2024.08.03 |
---|---|
BEAKJOON / 백준 - JAVA 11916번 볼질 (0) | 2024.08.02 |
BEAKJOON / 백준 - JAVA 14429번 배스킨라빈스 31 (0) | 2024.08.01 |
BAEKJOON / 백준 - JAVA 1384번 메시지 (0) | 2024.07.31 |
BAEKJOON / 백준 - JAVA 4108번 지뢰찾기 (0) | 2024.07.30 |