Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- class Solution
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine()); // the number of temperatures to analyse
- string[] inputs = Console.ReadLine().Split(' ');
- int min = 5527;
- for (int i = 0; i < n; i++)
- {
- int t = int.Parse(inputs[i]);// a temperature expressed as an integer ranging from -273 to 5526
- Console.Error.WriteLine(inputs[i]);
- if (Math.Abs(t)< Math.Abs (min))
- min = t;
- if ((Math.Abs(t)==Math.Abs (min)) && (t>min))
- min = Math.Abs(t);
- Console.Error.WriteLine(min);
- }
- if (min == 5527)
- min=0;
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- Console.WriteLine(min);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement