There was an error while loading. Please reload this page.
1 parent 08f9d3e commit 03db9abCopy full SHA for 03db9ab
Bon Appétit
@@ -0,0 +1,47 @@
1
+#!/bin/python3
2
+
3
+import math
4
+import os
5
+import random
6
+import re
7
+import sys
8
9
+# Complete the bonAppetit function below.
10
+def bonAppetit(bill, k, b,n):
11
+ sum1=0
12
13
+ for i in range(0,n):
14
+ if i==k :
15
+ continue
16
+ else:
17
+ sum1=sum1+bill[i]
18
+ pay1= sum1 // 2
19
20
+ if pay1==b:
21
+ print("Bon Appetit")
22
23
+ print(abs(pay1-b))
24
25
26
27
28
29
30
31
32
33
34
35
36
+if __name__ == '__main__':
37
+ nk = input().rstrip().split()
38
39
+ n = int(nk[0])
40
41
+ k = int(nk[1])
42
43
+ bill = list(map(int, input().rstrip().split()))
44
45
+ b = int(input().strip())
46
47
+ bonAppetit(bill, k, b,n)
0 commit comments