풀이
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
String A = st.nextToken();
String B = st.nextToken();
String C = st.nextToken();
String D = st.nextToken();
String ab = A + B;
String cd = C + D;
Long ans = Long.parseLong(ab) + Long.parseLong(cd);
System.out.println(ans);
}
}
틀린 코드
int ans = Integer.parseInt(ab) + Integer.parseInt(cd);
- int형 범위 초과
런타임 에러
- 입력 조건 확인 !