We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Bill Division

# Bill Division

baparson + 0 comments This problem and expected answers are bogus. To get

*true*cost, you should be evaluating using floating point, but using floats gets you "incorrect" answers for #4 and #5. Switching about to using ints you get all test cases passing. So this problem is pretty misleading.

AntonVS + 0 comments This problem is missing proper bindings / frame for the Javascript(node.js) language version.

jesdga95 + 0 comments Java solution:

import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int total = 0; for (int i = 0; i < n; i++) { int price = scanner.nextInt(); if (i != k) total += price; } int charged = scanner.nextInt(); System.out.println(total / 2 == charged ? "Bon Appetit" : charged - (total/2)); } }

unobatbayar + 0 comments Is it me or the input and questions are so hard to understand, I spent most of my time decoding what it's saying then moving on to actual problem solving and coding part. It's almost if I don't speak English, please stop making it extra complicated.

runcy + 0 comments Python one-liner logic:

n, k = map(int, input().strip().split(' ')) c = [int(x) for x in input().strip().split(' ')] b = int(input().strip()) print('Bon Appetit' if (sum(c) - c[k]) // 2 == b else c[k] // 2)

Load more conversations

Sort 910 Discussions, By:

Please Login in order to post a comment