-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchocfeast.py
25 lines (20 loc) · 912 Bytes
/
chocfeast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import math,sys
def get_more(wrappers,remaining_wrappers):
total_wrappers = wrappers + remaining_wrappers
new_chocolates = total_wrappers/wrapper_discount
if new_chocolates >= 1:
return int(new_chocolates) + \
get_more(int(new_chocolates),total_wrappers%wrapper_discount)
else:
return 0
if __name__ == "__main__":
#fo = open('D:\\Lebara\\output.txt','w+')
#fo = open(sys.stdout)
with open('D:\\Lebara\\input_data.txt') as f:
for x in f.readlines():
dollars,price,wrapper_discount = list(map(int,x.split(' ')))
#fo.writelines(str(int((dollars/price) + get_more(int(dollars/price),int(dollars%price))))+'\n')
#print(str(int((dollars/price) + get_more(int(dollars/price),int(dollars%price))))+'\n')
print(str(int((dollars/price) + get_more(int(dollars/price),0))))
f.close()
#fo.close()