Guest User

Untitled

a guest
Apr 9th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class HalfSumElements
  8. {
  9. static void Main(string[] args)
  10. {
  11. int n = int.Parse(Console.ReadLine());
  12. int[] array = new int[n];
  13. int result = 0;
  14. for (int i = 0; i < array.Length; i++)
  15. {
  16. array[i] = int.Parse(Console.ReadLine());
  17. result = array.Sum() - array.Max();
  18. }
  19. if (array.Max() == result)
  20. {
  21. Console.WriteLine("Yes Sum = {0}", string.Join(",", result));
  22. }
  23. else if(array.Max()!= result)
  24. {
  25. Console.WriteLine("No Diff = {0}", string.Join(",", Math.Abs(array.Max() - result)));
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment