Advertisement
TeMePyT

Untitled

May 22nd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06_thiefOnTheRun
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string thiefId = Console.ReadLine();
  10. int length = int.Parse(Console.ReadLine());
  11. long min = 0;
  12. long max = 0;
  13. if (thiefId == "sbyte")
  14. {
  15. min = sbyte.MinValue;
  16. max = sbyte.MaxValue;
  17. }
  18. else if (thiefId == "int")
  19. {
  20. min = int.MinValue;
  21. max = int.MaxValue;
  22. }
  23. else if (thiefId == "long")
  24. {
  25. min = long.MinValue;
  26. max = long.MaxValue;
  27. }
  28. long highestNum = long.MinValue;
  29.  
  30. for (int i = 1; i <= length; i++)
  31. {
  32. long idInput = long.Parse(Console.ReadLine());
  33. if (idInput >= min && idInput <= max && idInput > highestNum)
  34. {
  35. highestNum = idInput;
  36. }
  37. }
  38. Console.WriteLine(highestNum);
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement