Skip to content

Instantly share code, notes, and snippets.

@asuka-mirai
Created September 17, 2017 06:00
Show Gist options
  • Save asuka-mirai/d551e26a580374a5ba65fe318efd53ea to your computer and use it in GitHub Desktop.
Save asuka-mirai/d551e26a580374a5ba65fe318efd53ea to your computer and use it in GitHub Desktop.
N =int(input())
l = [int(input()) for _ in range(3)]
if N in l:
print('NO')
else:
flag = False
for i in range(100):
if N <= 3:
flag = True
break
elif N-3 not in l:
N -= 3
elif N-2 not in l:
N -= 2
elif N-1 not in l:
N -= 1
else:
break
print('YES' if flag else 'NO')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment