当前位置:网站首页>uva11100
uva11100
2022-07-21 07:48:00 【Stab the bear with a knife】
#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
const int maxn = 10007;
int n,m;
vector<int> ans[maxn];
map<int, int> mmp;
int main()
{
while (cin >> n && n) {
int input,num = 0;
mmp.clear();
for (int i = 0; i < n; i++) {
cin >> input;
mmp[input]++;
if (mmp[num] < mmp[input]) {
num = input;
}
}
m = mmp[num];
int first = 0;
for (int i = 0; i < m; i++) {
ans[i].clear();
}
for (auto it = mmp.begin(); it != mmp.end(); it++) {
if (it->first == num) {
for (int i = 0; i < m; i++)ans[i].push_back(num);
continue;
}
int cnt = it->second;
for (int i = 0; i < cnt; i++) {
ans[first].push_back(it->first);
first = (first + 1) % m;
}
}
cout << m << endl;
for (int i = 0; i < m; i++) {
for (int j = 0; j < ans[i].size(); j++) {
if (j)cout << " ";
cout << ans[i][j];
}
cout << endl;
}
}
return 0;
}
边栏推荐
- 低代码加速数字化转型的 5 种方式
- 2022/7/18-7/19
- 【IoT】产品经理:人性洞察的底层逻辑
- 2022 | Sample Efficiency Matters: A Benchmark for Practical Molecular Optimization
- LeetCode#572 另一颗树的子树
- 新建第一个HBuilder项目
- OCR/STR生僻字数据训练 | PaddleOCR的垂类Fine-tune(2)
- 2020华为云社区年度技术精选合集,700页+免费下载! | 云享·书库 No.01 期推荐(附免费下载)
- UIScrollView 和 UIPageControl 实现启动滑动图[通俗易懂]
- MySQL索引的数据结构
猜你喜欢
随机推荐
Yyds dry goods inventory # solve the real problem of famous enterprises: Criminal transfer
云生态大会,随“峰”而来!
Dall-E2和Imgen有什么区别?Reddit热帖盘点效果差异
Interface automation test -- pytest test test case design
[IOT] Product Manager: the underlying logic of human insight
Nextcloud personal cloud storage is an excellent choice: one click automatic installation method and cloud disk use experience
Ocr/str data training | vertical fine tune of paddleocr (2)
quarkus下的分布式ID怎么实现
Technical Analysis | Doris connector combined with Flink CDC to achieve accurate access to MySQL database and table exactly once
OSPF comprehensive experiment
乐高(LEGO)在线购物店面剖析
Insightface paddle User Guide (1)
R语言ggplot2可视化:可视化散点图并为散点图中的数据点添加文本标签、使用ggrepel包的geom_text_repel函数避免数据点之间的标签互相重叠(设置不同大小数据点的标签互相不重叠、分离
Hcip notes day 8
【暑期每日一题】洛谷 P8400 [CCC2022 J1] Cupcake Party
Do you really understand form data and request payload?
Chapter 1 Introduction to creating rest services
PMP考试重点难点汇总
Leetcode 101 symmetric binary tree
R语言ggplot2可视化:可视化分面散点图的标签数据为词云、使用ggrepel包的geom_text_repel函数避免词云标签互相重叠