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