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
| import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class FIX {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
while (cases-- > 0) {
int times = sc.nextInt();
ArrayList<integer> Q = new ArrayList<integer>();
for(int i=0;times>i;i++)
Q.add(sc.nextInt());
ArrayList<integer> copy_Q = new ArrayList<integer>(Q);
Collections.sort(Q);
int count = 0;
for(int i = 0;times>i;i++)
if(Q.get(i)==copy_Q.get(i))
count++;
System.out.println(count);
}
}
}
|
댓글 없음:
댓글 쓰기