Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06_thiefOnTheRun
- {
- class Program
- {
- static void Main(string[] args)
- {
- string thiefId = Console.ReadLine();
- int length = int.Parse(Console.ReadLine());
- long min = 0;
- long max = 0;
- if (thiefId == "sbyte")
- {
- min = sbyte.MinValue;
- max = sbyte.MaxValue;
- }
- else if (thiefId == "int")
- {
- min = int.MinValue;
- max = int.MaxValue;
- }
- else if (thiefId == "long")
- {
- min = long.MinValue;
- max = long.MaxValue;
- }
- long highestNum = long.MinValue;
- for (int i = 1; i <= length; i++)
- {
- long idInput = long.Parse(Console.ReadLine());
- if (idInput >= min && idInput <= max && idInput > highestNum)
- {
- highestNum = idInput;
- }
- }
- Console.WriteLine(highestNum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement