2864번: 5와 6의 차이
첫째 줄에 두 정수 A와 B가 주어진다. (1 <= A,B <= 1,000,000)
www.acmicpc.net
a,b = input().split()
a=[6 if i=='5' else i for i in a]
b=[6 if j=='5' else j for j in b]
a = "".join(list(map(str,a)))
b = "".join(list(map(str,b)))
c=int(a)+int(b)
a=[5 if i=='6' else i for i in a]
b=[5 if j=='6' else j for j in b]
a = "".join(list(map(str,a)))
b = "".join(list(map(str,b)))
d=int(a)+int(b)
print(d,c)
'알고리즘 PS > Greedy' 카테고리의 다른 글
백준 #11047번 동전 0 파이썬 (1) | 2024.01.30 |
---|---|
백준 #11399 ATM 파이썬 (1) | 2024.01.30 |
백준 #1439 뒤집기 (0) | 2023.08.27 |
백준 #4796 캠핑 (0) | 2023.08.27 |
백준 #2720번 세탁소 사장 (1) | 2023.08.27 |