Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class SumOfElements
- {
- static void Main(string[] args)
- {
- string inputLine = Console.ReadLine();
- string[] numbers = inputLine.Split(' ');
- long max = long.MinValue;
- long sum = 0;
- for (int i = 0; i < numbers.Length; i++)
- {
- int element = int.Parse(numbers[i]);
- sum = sum + element;
- if (element > max)
- {
- max = element;
- }
- }
- if (sum == (2 * max))
- {
- Console.WriteLine("Yes, sum=" + max);
- }
- else
- {
- long diff = Math.Abs(sum - (2 * max));
- Console.WriteLine("No, diff=" + diff);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment