Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _3.SearchForANumber
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. List<int> numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  15. var array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  16. List<int> listOperations = new List<int>();
  17. bool isTrue = false;
  18. for (int i = 0; i < array[0]; i++)
  19. {
  20. listOperations.Add(numbers[i]);
  21. }
  22. for (int i = 0; i < array[1]; i++)
  23. {
  24. listOperations.RemoveAt(0);
  25. }
  26. for (int i = 0; i < listOperations.Count; i++)
  27. {
  28. if (listOperations[i] == array[2])
  29. {
  30. isTrue = true;
  31. }
  32. }
  33. if (isTrue == true)
  34. {
  35. Console.WriteLine("YES!");
  36. }
  37. else
  38. {
  39. Console.WriteLine("NO!");
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement