码迷,mamicode.com
首页 > 其他好文 > 详细

hdu_1257

时间:2015-02-17 07:02:25      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

#include <cstdio>

int a[11111], n;

int main(int argc, char const *argv[])
{
    while(~scanf("%d", &n)){
        int m = 0;
        a[1] = -1;
        for(int i = 1, x; i <= n; ++i){
            scanf("%d", &x);
            int j = 1;
            for(; j <= m; ++j){
                if(a[j] >= x){
                    a[j] = x;
                    break;
                }
            }
            if(j > m)
                a[++m] = x;
        }
        printf("%d\n", m);
    }
    return 0;
}

 

hdu_1257

标签:

原文地址:http://www.cnblogs.com/takeoffyoung/p/4294775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!