Advertisement
EmoRz

CatchtheThief

May 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Numerics;
  4. using System.Linq;
  5.  
  6. namespace CatchTheTheif
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.            // Console.WriteLine(long.MinValue);
  13.             string idThief = Console.ReadLine();
  14.             var num = int.Parse(Console.ReadLine());
  15.             BigInteger max = 0;
  16.             if (idThief == "sbyte")
  17.             {
  18.                 max = sbyte.MaxValue;
  19.             }
  20.             if (idThief == "int")
  21.             {
  22.                 max = int.MaxValue;
  23.             }
  24.             if (idThief == "long")
  25.             {
  26.                 max = long.MaxValue;
  27.             }
  28.             long t = long.MinValue;
  29.  
  30.             for (int i = 1; i <= num; i++)
  31.             {
  32.                 long countIds = long.Parse(Console.ReadLine());
  33.                 if (max < countIds)
  34.                 {
  35.                     continue;
  36.                 }
  37.                 if (countIds>t)
  38.                 {
  39.                     t = countIds;
  40.                 }                
  41.             }
  42.             Console.WriteLine(t);
  43.  
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement