Created
April 5, 2019 14:25
-
-
Save nrgbatman/806a22ff4c140c995a8deee169852764 to your computer and use it in GitHub Desktop.
Контролно - Телерик Академи - Тест кейс 5.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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