UVA_11100_The Trip, 2007
来源:互联网 发布:数据库的结构层次 编辑:程序博客网 时间:2024/06/10 01:24
<pre name="code" class="cpp">#include<iostream>#include<sstream>#include<string>#include<vector>#include<list>#include<set>#include<map>#include<stack>#include<queue>#include<algorithm>#pragma warning(disable:4996)#include<cstdio>#include<cstdlib>using std::cin;using std::cout;using std::endl;using std::stringstream;using std::string;using std::vector;using std::list;using std::pair;using std::set;using std::multiset;using std::map;using std::multimap;using std::stack;using std::queue;using std::priority_queue;int main(){//freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n;while (cin >> n&&n){int m=0;//最少大背包数vector<int>hash(1000001, 0);vector<int>bag;for (int i = 0; i < n; i++){int value; cin >> value;bag.push_back(value);hash[value]++;m = std::max(m, hash[value]);}//输出所需要最小外层背包数cout << m << endl;std::sort(bag.begin(), bag.end());vector<vector<int>>piece(m);for (size_t i = 0; i != bag.size(); i++){piece[i%m].push_back(bag[i]);}for (size_t i = 0; i!=piece.size(); i++){for (size_t j = 0; j != piece[i].size(); j++){if (j){cout << ' ';}cout << piece[i][j];}cout << endl;}cout << endl;}return 0;}
0 0
- UVA_11100_The Trip, 2007
- The Trip. 2007
- 11100 - The Trip, 2007
- UVaOJ11100 - The Trip, 2007
- uva11100 - The Trip, 2007
- UVA11100- The Trip, 2007
- uva11100The Trip, 2007
- The Trip, 2007
- uva11100 - The Trip, 2007
- The Trip, 2007 UVA
- The Trip, 2007 UVA
- The Trip, 2007(贪心)
- Trip
- Trip
- UVA 11100 The Trip, 2007
- UVa 11100 - The Trip, 2007
- UVa 11100 - The Trip, 2007
- uva 11100 - The Trip, 2007
- iOS UITextField 使用详解
- B. Kuriyama Mirai's Stones
- 不能验证这个“安装 OS X EI Capitan”应用程序副本解决方法(已修正)
- 有用
- springmvc 常用的注解
- UVA_11100_The Trip, 2007
- c++的输入与输出,/r与/n的区别
- redis之数据安全与性能保障
- 机器学习实践指南(一)—— 总论
- caffe学习笔记3.2--前向传播和反向传播
- 绘制圆形以及球体
- 20160425待整理
- Linux计划任务,自动删除n天前的旧文件
- 机器学习之——多类分类问题