-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP158.java
50 lines (29 loc) · 960 Bytes
/
P158.java
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package aceptaelreto;
import java.util.*;
public class P158 {
static Scanner s;
static void llegir(int[] n, int m){
for(int i = 0; i < m; i++)
n[i] = s.nextInt();
}
static void cas(){
int amunt = 0;
int avall = 0;
int[] m;
int n = s.nextInt();
m = new int[n];
llegir(m,n);
for(int i = 0; i < n -1;i++){
if(m[i] < m[i+1])
amunt++;
else if(m[i] > m[i+1])
avall++;
}
System.out.printf("%d %d\n",amunt,avall);
}
public static void main(String[] args) {
s = new Scanner(System.in);
int n = s.nextInt();
for (int i = 0; i<n; i++)cas();
}
}