Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06_Problem_6.Catch_the_Thief
- {
- class ProgramCatch_the_Thief
- {
- static void Main()
- {
- string numeralType = Console.ReadLine();
- int nums = int.Parse(Console.ReadLine());
- long max = long.MinValue;
- switch (numeralType)
- {
- case "sbyte":
- try
- {
- for (int i = 0; i < nums; i++)
- {
- sbyte now = sbyte.Parse(Console.ReadLine());
- max = Math.Max(max, now);
- }
- }
- catch (Exception)
- {
- }; break;
- case "int":
- try
- {
- for (int i = 0; i < nums; i++)
- {
- int now = int.Parse(Console.ReadLine());
- max = Math.Max(max, now);
- }
- }
- catch (Exception)
- {
- }; break;
- case "long":
- try
- {
- for (int i = 0; i < nums; i++)
- {
- long now = long.Parse(Console.ReadLine());
- max = Math.Max(max, now);
- }
- }
- catch (Exception)
- {
- }; break;
- }
- Console.WriteLine(max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement