-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathBreakingtheRecords.java
More file actions
31 lines (27 loc) · 794 Bytes
/
Copy pathBreakingtheRecords.java
File metadata and controls
31 lines (27 loc) · 794 Bytes
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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] score = new int[n];
for(int score_i=0; score_i < n; score_i++){
score[score_i] = in.nextInt();
}
int max = score[0], min = score[0];
int maxCount=0, minCount=0;
for(int i=1;i<n;i++){
if(score[i]>max){
max = score[i];
maxCount++;
} else if(score[i] < min) {
min = score[i];
minCount++;
}
}
System.out.println(maxCount + " " + minCount);
}
}