Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Half_Sum_Element
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countNum = int.Parse(Console.ReadLine());
- int max = int.MinValue;
- int total = 0;
- for(int i=1;i<= countNum;i++)
- {
- int Num = int.Parse(Console.ReadLine());
- if(Num>max)
- {
- max = Num;
- total += Num;
- }
- else
- {
- total += Num;
- }
- }
- if(total-max==max)
- {
- Console.WriteLine("Yes");
- Console.WriteLine($"Sum = {max}");
- }
- else
- {
- int diff = Math.Abs(max - (total - max));
- Console.WriteLine("No");
- Console.WriteLine($"Diff = {diff}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement