31을 외치는 순간 외친 사람이 게임에서 진다. 시온이가 이기려면 시온이가 30을 외쳐야 한다는 것이다. 이를 이용해서 코드로 작성하면 해결할 수 있다.
import sys input = sys.stdin.readline A = int(input()) for i in range(1, A+1): temp = i + 1 if 30 % temp == 0: print(i)