Skip to content

Instantly share code, notes, and snippets.

@nrgbatman
Created April 5, 2019 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrgbatman/806a22ff4c140c995a8deee169852764 to your computer and use it in GitHub Desktop.
Save nrgbatman/806a22ff4c140c995a8deee169852764 to your computer and use it in GitHub Desktop.
Контролно - Телерик Академи - Тест кейс 5.
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main(string[] args)
{
string n = Console.ReadLine();
int[] m = n.Split(' ').Select(x => int.Parse(x)).ToArray();
int N = m[0];
int L = m[1];
int R = m[2];
int[] result = new int[N];
string input2 = Console.ReadLine();
List<int> without = input2.Split(' ').Select(x => int.Parse(x)).ToList();
string intput3 = Console.ReadLine();
List<int> reserve = intput3.Split(' ').Select(x => int.Parse(x)).ToList();
int z = 0;
int checker = 0;
for (int i = 0; i < without.Count; i++)
{
checker = without[i];
for (int y = 0; y < reserve.Count; y++)
{
if (checker == reserve[y])
{
without[i] = -10;
reserve[y] = -100;
}
}
}
for (int i = 0; i < without.Count; i++)
{
z = without[i];
for (int y = 0; y < reserve.Count; y++)
{
if (z == reserve[y] - 1)
{
without[i] = -100;
reserve[y] = 0;
continue;
}
if (z == reserve[y] + 1)
{
without[i] = -100;
reserve[y] = 0;
continue;
}
}
}
int count = 0;
foreach (int item in without)
{
if (item > 0 && item <11)
{
count++;
}
}
Console.WriteLine(count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment