Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CathcTheThief
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var str = Console.ReadLine();
  14. byte count = byte.Parse(Console.ReadLine());
  15. long max = 0;
  16. switch (str)
  17. {
  18. case "sbyte":
  19. max = sbyte.MaxValue;
  20. break;
  21. case "int":
  22. max = int.MaxValue;
  23. break;
  24. case "long":
  25. max = long.MaxValue;
  26. break;
  27. }
  28. long idThief = long.MinValue;
  29. for (int i = 0; i < count; i++)
  30. {
  31. long idCurrent = long.Parse(Console.ReadLine());
  32. if (idCurrent > idThief && idCurrent <= max)
  33. {
  34. idThief = idCurrent;
  35. }
  36. }
  37. Console.WriteLine(idThief);
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement