import java.util.Scanner;
public class 递增三元组的中心 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n=scanner.nextInt();
int[] shuzu=new int[n];
for (int i = 0; i < n; i++) {
shuzu[i]=scanner.nextInt();
}
int count=0;
for (int i = 0; i < n-2; i++) {
for (int j = i+1; j < n-1; j++) {
for (int k = j+1; k <n; k++) {
if (shuzu[i]<shuzu[j]&& shuzu[j]<shuzu[k]) {
count++;
shuzu[j]=0;
break;
}
}
}
}
System.out.println(count);
}
}
递增三元组的中心(Java实现)
最新推荐文章于 2024-07-03 02:43:21 发布