-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
35 lines (28 loc) · 1.05 KB
/
Program.cs
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
using System;
using System.Linq;
namespace Breaking_the_Records {
class Program {
public static int[] BreakingRecords(int[] scores) {
int highestScore = scores.First(),
lowestScore = scores.First(),
increased = 0,
decreased = 0;
for (int i = 0; i < scores.Length; i++) {
if (scores[i] > highestScore) {
highestScore = scores[i];
increased++;
} else if (scores[i] < lowestScore) {
lowestScore = scores[i];
decreased++;
}
}
return new int[] { increased, decreased };;
}
static void Main(string[] args) {
int n = Convert.ToInt32(Console.ReadLine());
int[] scores = Array.ConvertAll(Console.ReadLine().Split(' '), scoresTemp => Convert.ToInt32(scoresTemp));
int[] result = BreakingRecords(scores);
Console.WriteLine("{0}", string.Join(" ", result));
}
}
}