동캄의 코딩도장

백준 10610 [30] 파이썬 본문

코테/BOJ

백준 10610 [30] 파이썬

동 캄 2025. 3. 15. 17:46
반응형

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

 

#백준 10610 30

lst=list(map(int,input().rstrip()))
lst.sort(reverse=True)
error_flg=False
if sum(lst)%3!=0: #3의 배수인지 확인
    error_flg=True

if lst[-1]!=0: #10의 배수인지 확인
    error_flg=True

if error_flg: #30의 배수 아니라면
    print(-1)
else: #30의 배수 맞다면
    print(''.join(list(map(str,lst))))

 

반응형