Advertisement
Guest User

Untitled

a guest
Oct 7th, 2016
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class PairsByDifference
  6. {
  7. static void Main()
  8. {
  9. var list = Console.ReadLine().Split().Select(int.Parse).ToList();
  10. var diff = int.Parse(Console.ReadLine());
  11. var count = 0;
  12.  
  13. foreach (var num in list)
  14. {
  15. foreach (var nums in list)
  16. {
  17. if (num-nums==diff)
  18. {
  19. count++;
  20. }
  21. }
  22. }
  23. Console.WriteLine(count);
  24.  
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement