Advertisement
Guest User

Untitled

a guest
Feb 16th, 2016
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. class EqualPairs
  4. {
  5. static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8.  
  9. int currentSum = 0;
  10. int previousSum = 0;
  11. int maxDiff = 0;
  12. int currentDiff = 1;
  13.  
  14. for (int i = 1; i <= n; i++)
  15. {
  16. previousSum = currentSum;
  17. int a = int.Parse(Console.ReadLine());
  18. int b = int.Parse(Console.ReadLine());
  19. currentSum = a + b;
  20. currentDiff = Math.Abs(currentSum - previousSum);
  21. if (currentDiff > maxDiff && i >= 2)
  22. {
  23. maxDiff = currentDiff;
  24. }
  25. }
  26. if (maxDiff == 0)
  27. {
  28. Console.WriteLine("Yes value " + currentSum);
  29. }
  30. else
  31. {
  32. Console.WriteLine("no maxdiff " + maxDiff);
  33. }
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement