Monday, August 6, 2018

Bon Appétit : Algorithms - Implementation

#The solution in Python3 is as follows:


n,k=map(int,input().split())
a=list(map(int,input().split()))
b=int(input())
bac=(sum(a)-a[k])//2
if bac==b:
       print("Bon Appetit")
elif bac<b:
       print(b-bac)

#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!