Advertisement
EmoRz

CatchTheThief_1.1

May 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 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.             BigInteger t = 0;
  29.             List<BigInteger> getMax = new List<BigInteger>();
  30.             for (int i = 0; i < num; i++)
  31.             {
  32.                 BigInteger countIds = BigInteger.Parse(Console.ReadLine());
  33.                 if (countIds <= max)
  34.                 {
  35.                     getMax.Add(countIds);
  36.                    
  37.                 }
  38.             }
  39.             t = getMax.Max();
  40.             Console.WriteLine(t);
  41.  
  42.  
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement