1 #include " iostream "
2 #define M 50000
3 using namespace std;
4 int n;
5 int a[M];
6 int i,j;
7 int used[M];
8 int flag = 0 ;
9 int main()
10 {
11 while (cin >> n)
12 {
13 for (i = 0 ;i < n;i ++ )
14 cin >> a[i];
15 memset(used, 0 , sizeof (used));
16 flag = 0 ;
17 for (i = 0 ; i < n; i ++ )
18 {
19 if (used[i] == 0 )
20 {
21 flag ++ ;
22 int x = i;
23 used[x] = 1 ;
24 for (j = i + 1 ;j < n;j ++ )
25 {
26 if (a[x] > a[j] && used[j] == 0 )
27 {
28 used[j] = 1 ;
29 x = j;
30 }
31
32 }
33
34 }
35 }
36 cout << flag << endl;
37 }
38 return 0 ;
39 }
转载于:https://my.oschina.net/garyun/blog/602830