[python]伯準2908号:定数


Problem
https://www.acmicpc.net/problem/2908
Solution
code 1
1つ目の方法は、リストを使用する方法です.
a, b = input().split()

# 리스트로 변경
a_list = list(a)
b_list = list(b)

# 리스트 뒤집기
a_list.reverse()
b_list.reverse()

# 리스트 -> 문자열 변환
a = ''.join(a_list)
b = ''.join(b_list)

a = int(a)
b = int(b)

print(max(a,b))
code 2
2つ目の方法は、文字列を使用してスライドする方法です.
a, b = input().split()

a = int(a[::-1])
b = int(b[::-1])

print(max(a,b))
Comment
第1の方法で問題を解決し,別の方法を探す際に第2の方法を知った.リストに変換して文字列に変換する手間もなく、簡単に解決できます.
Ref
https://blockdmask.tistory.com/581