-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBills.py
More file actions
30 lines (27 loc) · 705 Bytes
/
Copy pathBills.py
File metadata and controls
30 lines (27 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def LemonadeChange(Bills):
five = 0
ten = 0
for bill in Bills:
if bill == 5:
five += 1
elif bill == 10:
if five>0:
five -= 1
ten += 1
else:
return "false"
count += 1
elif bill == 20:
if five>0 and ten>0:
five -= 1
ten -= 1
elif five >= 3:
five -= 3
else:
return "false"
return "true"
# 如果前面没有返回false就会返回这个true。
if __name__ == "__main__":
Bills = list(map(int, input().split()))
result=LemonadeChange(Bills)
print(result)