代码:
#include <bits/stdc++.h> using namespace std; int a[100005]; bool a1[100005]; int main(){ int i = 1; while(cin>>a[i]){ a1[i] = false; i++; } i--; int ant = 0,x = a[1],j = 2,sum = 1; a1[1] = true; while(sum<=i){ for(;j<=i;j++){ if(a[j]<=x && a1[j]==false){ x = a[j]; a1[j] = true; sum++; } } ant++; int t1 = x; for(int t = 1;t<=i;t++){ if(a1[t]==false){ x = a[t]; a1[t] = true; j = t+1; sum++; break; } } if(t1==x){ break; } } cout<<ant; return 0; }
标签:1322,奥赛,int,sum,a1,6.4,Noip1999 From: https://www.cnblogs.com/wangyihang-xh/p/18487266