프로그래밍/HackerRank
[HackerRank][Python3] Halloween Sale
snoopybox
2018. 9. 6. 21:34
Problem :
https://www.hackerrank.com/challenges/halloween-sale/problem
My Solution :
#!/usr/bin/env python3
def how_many_games(p, d, m, s):
count = 0
while p <= s:
s -= p
p = max(m, p-d)
count += 1
return count
p, d, m, s = map(int, input().split())
answer = how_many_games(p, d, m, s)
print(answer)