https://www.acmicpc.net/problem/2864
2864번: 5와 6의 차이
첫째 줄에 두 정수 A와 B가 주어진다. (1 <= A,B <= 1,000,000)
www.acmicpc.net
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
String s1 = st.nextToken();
String s2 = st.nextToken();
int max = Integer.parseInt(s1.replaceAll("5", "6")) + Integer.parseInt(s2.replaceAll("5", "6"));
int min = Integer.parseInt(s1.replaceAll("6", "5")) + Integer.parseInt(s2.replaceAll("6", "5"));
System.out.print(min + " " + max);
}
}
'OJ' 카테고리의 다른 글
[BOJ] 2935 소음 (JAVA) (0) | 2023.02.23 |
---|---|
[BOJ] 5555 반지 (JAVA) (0) | 2023.02.22 |
[BOJ] 1254 팰린드롬 만들기 (JAVA) (0) | 2023.02.20 |
[BOJ] 10820 문자열 분석 (JAVA) (0) | 2023.02.19 |
[BOJ] 4358 생태학 (JAVA) (0) | 2023.02.18 |