Skip to content

Instantly share code, notes, and snippets.

@ellenia
Created June 6, 2017 22:37
Show Gist options
  • Save ellenia/cc0c699be01a1e73a0c5d4547d628f23 to your computer and use it in GitHub Desktop.
Save ellenia/cc0c699be01a1e73a0c5d4547d628f23 to your computer and use it in GitHub Desktop.
class Program
{
static void Main(String[] args)
{
string fileName =
System.Environment.GetEnvironmentVariable("OUTPUT_PATH");
TextWriter tw = new StreamWriter(@fileName, true);
string res;
int _arr_size = 0;
_arr_size = Convert.ToInt32(Console.ReadLine());
int[] _arr = new int[_arr_size];
int _arr_item;
for (int _arr_i = 0; _arr_i < _arr_size; _arr_i++)
{
_arr_item = Convert.ToInt32(Console.ReadLine());
_arr[_arr_i] = _arr_item;
}
int _k;
_k = Convert.ToInt32(Console.ReadLine());
res = findNumber(_arr, _k);
tw.WriteLine(res);
tw.Flush();
tw.Close();
}
private static string findNumber(int[] arr, int k)
{
for (int i = 0; i < arr.Length; i++)
{
if (arr[i] == k)
return "YES";
}
return "NO";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment