백준 10757번 자바 : 큰 수 A+B

Rena·2022년 3월 13일

알고리즘 문제풀이

목록 보기
6/45
  1. java.math.BigInteger 사용
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        BigInteger A = in.nextBigInteger();
        BigInteger B = in.nextBigInteger();

        BigInteger sum = A.add(B);

        System.out.println(sum.toString());
    }
}
  1. 더하고자 하는 자릿수만큼의 배열 생성하여 올림하면서 계산
profile
일을 사랑하고 싶은 개발자

0개의 댓글