1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import java.util.*;
public class Main {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next();
for(int i=0; i<a.length(); i++) { if(a.charAt(i)=='6') a = a.replace("6", "5"); } for(int i=0; i<b.length(); i++) { if(b.charAt(i)=='6') b = b.replace("6", "5"); } System.out.println(Integer.parseInt(a) + Integer.parseInt(b));
for(int i=0; i<a.length(); i++) { if(a.charAt(i)=='5') { a = a.replace("5", "6"); } } for(int i=0; i<b.length(); i++) { if(b.charAt(i)=='5') { b = b.replace("5", "6"); } } System.out.println(Integer.parseInt(a) + Integer.parseInt(b));
sc.close();
}
}
|
'알고리즘 > 백준' 카테고리의 다른 글
[백준 2522번 ː 자바(JAVA)] 별 찍기 - 12 (0) | 2020.07.17 |
---|---|
[백준 2445번 ː 자바(JAVA)] 별 찍기 - 8 (1) | 2020.07.17 |
[백준 2675번 ː 자바(JAVA)] 문자열 반복 (0) | 2020.07.14 |
[백준 10809번 ː 자바(JAVA)] 알파벳 찾기 (0) | 2020.07.14 |
[백준 2444번 ː 자바(JAVA)] 별 찍기 7 (0) | 2020.07.14 |