hdu1257

ContractedBlock.gif ExpandedBlockStart.gif
 
   
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://www.cnblogs.com/FCWORLD/archive/2011/03/23/1992980.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值