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.
string[] input1 = Console.ReadLine().Split(' ');
int n=Convert.ToInt32(input1[0]);
int k=Convert.ToInt32(input1[1]);
int[] c=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int b = Convert.ToInt32(Console.ReadLine());
int sum1= c.Where((x, i) => i != k).Sum();
if (b == sum1/2)
Console.WriteLine("Bon Appetit");
else
Console.WriteLine(b - sum1/2);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bill Division
You are viewing a single comment's thread. Return to all comments →
A simple C# solution: