题意:后一个比前一个大就加一,问最大次数。
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<iostream> 5 #include<cstdlib> 6 #include<string> 7 #include<cmath> 8 #include<vector> 9 using namespace std; 10 const int maxn=1e5+7; 11 const double eps=1e-8; 12 const double pi=acos(-1); 13 const int inf = 0x3f3f3f3f; 14 #define ll long long 15 #define clc(a,b) memset(a,b,sizeof(a)) 16 17 int main() 18 { 19 int n; 20 scanf("%d",&n); 21 int a[1010]; 22 clc(a,0); 23 for(int i=0;i<n;i++) 24 { 25 int x; 26 scanf("%d",&x); 27 a[x]++; 28 } 29 int maxx=-inf; 30 for(int i=0;i<=1000;i++) 31 { 32 if(maxx<a[i]) 33 maxx=a[i]; 34 } 35 printf("%d ",n-maxx); 36 return 0; 37 }