-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemperatures
More file actions
37 lines (32 loc) · 1.11 KB
/
Copy pathtemperatures
File metadata and controls
37 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 result = 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(t+" "+result);
if(Math.Abs(result) == t)result = t;
else if(Math.Abs(t) < Math.Abs(result))result = t;
Console.Error.WriteLine(Math.Abs(t));
}
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
if(result == 5527) result = 0;
Console.Error.WriteLine(result);
Console.WriteLine(result);
}
}