728x90
반응형

문제 주소: codeforces.com/problemset/problem/339/A

파이썬의 꼼수(잡기술)를 좀 사용해봤다. 

li = sorted(list(map(int, input().split('+'))))
print(*li, sep='+')

파이썬에서 *은 컨테이너 타입의 데이터를 Unpacking 해준다.

EX) *[1, 2, 3] -> 1, 2, 3

print 함수에서 sep를 사용하면 print문의 출력문들 사이에 해당하는 문자를 넣을 수 있다.

EX) print(1, 2, 3, sep='A') -> 1A2A3

728x90
반응형

'Agorithm > Codeforces' 카테고리의 다른 글

236A-Boy or Girl  (0) 2021.02.16
281A-Word Capitalization  (0) 2021.02.16
263A-Beautiful Matrix  (0) 2021.02.16
112A-Petya and Strings  (0) 2021.02.16
282A-Bit++  (0) 2021.02.16

+ Recent posts