-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (18 loc) · 713 Bytes
/
Program.cs
File metadata and controls
25 lines (18 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Linq;
namespace Bill_Division {
class Program {
public static void BonAppetit(int[] ar, int k, int b) {
int bill = (ar.Sum() - ar[k]) / 2;
Console.WriteLine((bill == b) ? "Bon Appetit" : (b - bill).ToString());
}
static void Main(string[] args) {
string[] nk = Console.ReadLine().TrimEnd().Split(' ');
int n = Convert.ToInt32(nk[0]);
int k = Convert.ToInt32(nk[1]);
int[] ar = Array.ConvertAll(Console.ReadLine().Split(' '), arTemp => Convert.ToInt32(arTemp));
int b = Convert.ToInt32(Console.ReadLine().Trim());
BonAppetit(ar, k, b);
}
}
}