盒子题: 运气AC #include <iostream> #include <map> using namespace std; int main( ) { int n, x; while(cin>>n ){ map<int, int> mp; for(int i=0; i< n; ++i) { cin>>x; mp[x]++; } int res=0,flag = true; while(1){ for(auto& a : mp){ if(a.second > 0) a.second--; } flag = true; for(auto& a : mp){ if(a.second != 0) flag = false; } ++res; if(flag) break; } cout<<res<<endl; } return 0; }
点赞 评论

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务