forked from Srinivas11789/AlgorithmNuggets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbon.py
More file actions
25 lines (21 loc) · 600 Bytes
/
bon.py
File metadata and controls
25 lines (21 loc) · 600 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
# Enter your code here. Read input from STDIN. Print output to STDOUT
def testSplit(n, m, prices, charge):
n = len(prices)
total_shared = 0
for i in range(n):
if i == int(m):
pass
else:
total_shared += int(prices[i])
her_share = total_shared//2
if her_share == int(charge):
return "Bon Appetit"
else:
return int(charge) - her_share
# Main logic - custom
def main():
n, m = raw_input().strip().split(" ")
prices = raw_input().split(" ")
charge = raw_input()
print testSplit(n,m,prices,charge)
main()