Advertisement
didatzi

P03_SearchForANumber

Jun 14th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace P03_SearchForANumber
  8. {
  9.     class P03_SearchForANumber
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var numbersList = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  14.             var numArr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  15.             var newList = new List<int>();
  16.             for (int i = 0; i < numArr[0]; i++)
  17.             {
  18.                 newList.Add(numbersList[i]);
  19.             }
  20.             for (int i = 0; i < numArr[1]; i++)
  21.             {
  22.                 newList.Remove(newList[0]);
  23.             }
  24.             if (newList.Contains(numArr[2]))
  25.             {
  26.                 Console.WriteLine("YES!");
  27.             }
  28.             else
  29.             {
  30.                 Console.WriteLine("NO!");
  31.             }
  32.            
  33.             //Console.WriteLine(string.Join(" ", newList));
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement