2338번: 긴자리 계산
첫째 줄에 A+B, 둘째 줄에 A-B, 셋째 줄에 A×B를 출력한다. 각각을 출력할 때, 답이 0인 경우를 제외하고는 0으로 시작하게 해서는 안 된다(1을 01로 출력하면 안 된다는 의미).
www.acmicpc.net
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import java.util.*; import java.io.*; import java.math.BigInteger; public class Q2338 { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); BigInteger A = scanner.nextBigInteger(); BigInteger B = scanner.nextBigInteger(); System.out.println(A.add(B)); System.out.println(A.subtract(B)); System.out.println(A.multiply(B)); } } | cs |