Short Problem Definition:
Anna and Brian are sharing a meal at a restaurant and they agree to split the bill equally. Brian wants to order something that Anna is allergic to though, and they agree that Anna won’t pay for that item. Brian gets the check and calculates Anna’s portion. You must determine if his calculation is correct.
Link
Complexity:
time complexity is O(N)
space complexity is O(1)
Execution:
Follow the specification.
Solution:
1
2
3
4
5
6
7
8
9
10
11
12

#!/bin/python n, k = map ( int , raw_input ().split()) c = map ( int , raw_input ().split()) charge = input () should_have = ( sum (c)  c[k]) / 2 diff = charge  should_have if not diff: print "Bon Appetit" else : print diff 