30(그리디)

mangyun·2021년 11월 30일
0

BOJ

목록 보기
15/21

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

1. 코드

n = list(input())

n.sort(reverse=True)

s = ''.join(n)

if int(s) % 30 != 0:
    print(-1)
else:
    print(int(s))

2. 아이디어

리스트를 문자열로 - ''.join(s)
각 자리 수의 합이 3의 배수

profile
기억보다는 기록을 하자.

0개의 댓글