2864번 : 5와 6의 차이 - Python

Pobi·2023년 1월 3일
0

PS

목록 보기
3/107
post-thumbnail

문제

https://www.acmicpc.net/problem/2864

풀이

두수의 합이 최솟값이 될려면 상근이가 6을 5로 보면 된다.
마찬가지로 두수의 합이 최댓값이 될려면 상근이가 5를 6으로 본 수를 더하면 된다.

코드

from sys import stdin, stdout

input = stdin.readline 

a, b = input().split()

a_min = a.replace('6','5')
b_min = b.replace('6','5')

a_max = a.replace('5','6')
b_max = b.replace('5','6')

print(int(a_min)+int(b_min),int(a_max)+int(b_max))
profile
꿈 많은 개발자

0개의 댓글