Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _10.Pairs
- {
- class Pairs
- {
- static void Main()
- {
- var input = Console.ReadLine().Split().Select(long.Parse).ToList();
- long neededNumber = long.Parse(Console.ReadLine());
- int counter = 0;
- for (int i = 0; i < input.Count; i++)
- {
- for (int j = i + 1; j < input.Count; j++)
- {
- if (Math.Abs(input[i] - input[j]) == neededNumber)
- {
- counter++;
- }
- }
- }
- Console.WriteLine(counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement