Advertisement
martinvalchev

Search_for_a_Number

Feb 10th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Search_for_a_Number
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<int> numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  12.             int[] comand = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  13.  
  14.             if (numbers.Take(comand[0]).Skip(comand[1]).Contains(comand[2]))
  15.             {
  16.                 Console.WriteLine("YES!");
  17.             }
  18.             else
  19.             {
  20.                 Console.WriteLine("NO!");
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement