有没有大佬帮忙看一下哪里不对
查看原帖
有没有大佬帮忙看一下哪里不对
1568006
TianYuhan129楼主2024/11/23 11:19
#include<stdio.h>
int main(){
	int n,count=0;
	scanf("%d\n",&n);
	int a[n];
	for(int i=0;i<n-1;i++){
		scanf("%d ",&a[i]);
	}
	for(int x=0;x<n-1;x++){
		if(a[x]<a[x-1]){
			for(int y=x;y<n-1;y++){
				if(a[y+1]>a[y]){
					count+=1;
				}	
			}		
	    }
	}
	printf("%d",count);
	return 0;
}
2024/11/23 11:19
加载中...