Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _03_SearchForNumber
- {
- class Program
- {
- static void Main()
- {
- List<int> inputList = Console.ReadLine().Split().Select(int.Parse).ToList();
- int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int addNumbers = arr[0];
- int delete = arr[1];
- int searchedNum = arr[2];
- var outputList = new List<int>();
- for (int i = 0; i < addNumbers; i++)
- {
- outputList.Add(inputList[i]);
- }
- for (int i = 0; i < delete; i++)
- {
- outputList.RemoveAt(0);
- }
- bool result = false;
- for (int i = 0; i < outputList.Count; i++)
- {
- result = outputList.Contains(searchedNum);
- }
- if (result)
- {
- Console.WriteLine("YES!");
- }
- else
- {
- Console.WriteLine("NO!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement