标签:
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 919 Accepted Submission(s):
501
#include<stdio.h> #include<string.h> #include<algorithm> #define MAX 100100 using namespace std; int a[MAX]; int main() { int n,m,t,i,j; scanf("%d",&t); int maxx,ans; while(t--) { scanf("%d",&n); maxx=0; for(i=1;i<=n;i++) { scanf("%d",&a[i]); if(maxx<a[i]) { maxx=a[i]; ans=i; } } int ant=ans,sum=0; for(j=ans;j>=1;j--) { if(a[j]==a[ant]-1) { sum++; ant=j; } } printf("%d\n",n-sum-1); } return 0; }
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4964854.html