[백준 10757] 큰수 A+B in Java

Heejeong Choi·2021년 10월 10일
0

백준 10757번 문제

문제도 초간단 ㅎㅎ ! 딱 받자마자 엉..? Long 범위를 넘는 것 같다는 생각이 가장 먼저 들었다😂 우선 접근을 어떻게해야 할까.. 하고 깊게 생각했다ㅠㅠ 나는 코테에 정말정말정말 약하고 항상 쫄아있다..

자바는 큰수를 java.math의 BigInteger 클래스를 사용하여 정의 할 수 있다고!!!!

class Main {
   public static void main(String[] args) throws Exception {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      
      String[] arr = br.readLine().split(" ");
      System.out.println(new BigInteger(arr[0]).add(new BigInteger(arr[1])));
   }
}

BigInteger class는 아래에서 참고할 수 있습니다👀

profile
Welcome to my velog! I love learning something new to build up my ability in development field. I don't think it is shame not to know, but it is shame to pretend to know about something you don't know.

0개의 댓글