Skip to content

Instantly share code, notes, and snippets.

@jo32
Created October 12, 2015 12:12
Show Gist options
  • Save jo32/0509bff5ada8db52bb37 to your computer and use it in GitHub Desktop.
Save jo32/0509bff5ada8db52bb37 to your computer and use it in GitHub Desktop.
CODEFORCE 189A
[n, a, b, c] = [int(i) for i in raw_input().split(' ')]
dp = [0] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
dp[i] = max(
dp[i - a] if i - a >= 0 else -4001,
dp[i - b] if i - b >= 0 else -4001,
dp[i - c] if i - c >= 0 else -4001
) + 1
print dp[n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment