首页 > 其他 > 详细

繁华模拟赛 ljw搭积木

时间:2016-09-24 23:21:14      阅读:188      评论:0      收藏:0      [点我收藏+]

技术分享

技术分享


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 6005;
int n,x[maxn];
int cmd,cnt,ans,max_x;
int main(){
    freopen("box.in","r",stdin);
    freopen("box.out","w",stdout);
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 1;i <= n;i++){
        cin>>cmd;
        x[cmd]++;
        max_x = max(max_x,cmd);
    }
    while(1){
        cnt = 0;
        for(int i = 0;i <= max_x;i++){
            while(x[i] && i >= cnt){
                x[i]--;
                cnt++;
            }
        }
        if(!cnt) break;
        ans += 1;
    }
    cout<<ans;
    return 0;
}

 

繁华模拟赛 ljw搭积木

原文:http://www.cnblogs.com/hyfer/p/5904418.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!