algorithm/문제 풀이

백준 1271번 (엄청난 부자2) 자바 Java11

ssoheeh 2021. 1. 2. 01:31

문제 : 엄청난 부자2

시간 제한 : 2 sec

메모리 제한 : 128 MB

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.util.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String[] temp = str.split(" ");
        BigInteger m = new BigInteger(temp[0]);
        BigInteger n = new BigInteger(temp[1]);
        
        System.out.println(m.divide(n));
        System.out.println(m.remainder(n));
    }
}
cs

 

자바에서 큰 수 입력 시 BigInteger 사용!