728x90
문제
https://www.acmicpc.net/problem/2338
풀이 코드
- 1000자리 이하의 수를 계산하기 위해 BigInteger타입 사용
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BigInteger a = new BigInteger(br.readLine());
BigInteger b = new BigInteger(br.readLine());
System.out.println(a.add(b));
System.out.println(a.subtract(b));
System.out.println(a.multiply(b));
}
}
'알고리즘 문제풀이 > 백준' 카테고리의 다른 글
[백준] 2914 저작권 - 자바 (0) | 2021.09.16 |
---|---|
[백준] 2845 파티가 끝나고 난 뒤 - 자바 (0) | 2021.09.16 |
[백준] 1550 16진수 - 자바 (0) | 2021.09.15 |
[백준] 1271 엄청난 부자2 - 자바, BigInteger (0) | 2021.09.15 |
[백준] 9019 DSLR - 자바, BFS(너비 우선 탐색) (0) | 2021.07.25 |
댓글