链接:

https://codeforces.com/contest/1220/problem/A

题意:

When Serezha was three years old, he was given a set of cards with letters for his birthday. They were arranged into words in the way which formed the boy's mother favorite number in binary notation. Serezha started playing with them immediately and shuffled them because he wasn't yet able to read. His father decided to rearrange them. Help him restore the original number, on condition that it was the maximum possible one.

思路:

优先找1, 再找0

代码:

#include <bits/stdc++.h>
using namespace std; map<char, int> Mp; int main()
{
int n;
char c;
cin >> n;
for (int i = 1;i <= n;i++)
{
cin >> c;
Mp[c]++;
}
int one = min(Mp['o'], min(Mp['n'], Mp['e']));
Mp['o'] -= one, Mp['n'] -= one, Mp['e'] -= one;
int zero = min(Mp['z'], min(Mp['e'], min(Mp['r'], Mp['o'])));
for (int i = 1;i <= one;i++)
cout << 1 << ' ' ;
for (int i = 1;i <= zero;i++)
cout << 0 << ' ' ;
cout << endl; return 0;
}

Codeforces Round #586 (Div. 1 + Div. 2) A. Cards的更多相关文章

  1. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  2. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  3. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  4. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  5. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  6. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  7. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  8. Educational Codeforces Round 39 (Rated for Div. 2) G

    Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...

  9. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  10. Educational Codeforces Round 60 (Rated for Div. 2) 题解

    Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...

随机推荐

  1. react项目中关于img标签的src属性的使用

    在一个html文件中,img的src属性赋值为相对路径或绝对路径的字符串即可访问到图片.如下: <img src="../images/photo.png"/> 但在j ...

  2. k8s之RBAC-基于角色的访问控制

    一个在名称空间内的对象的完整url模板: Object_URL: /apis/<GROUP>/<VERSION>/namespaces/<NAMESPACE_NAME&g ...

  3. UVA Tress in a Wood

    https://vjudge.net/problem/UVA-10214 题意:给定一个坐标系.|x|<=a, |y|<=b 求坐标系中有多少点是可以从原点直接看到(即从原点和一个点连线, ...

  4. dev linechart动态加载数据(像股票一样的波动)

    图片地址:https://blog.csdn.net/qq_33459369/article/details/80060196:(盗图) 接下来是封装的代码 #region 动态折线图 public ...

  5. 阿里云=>RHSA-2019:1884-中危: libssh2 安全更新

    由于项目构建时间比较长,近期安全检查发现openssh有漏洞.所以要升级openssh到7.9p1版本.由于ssh用于远程连接,所以要谨慎操作. 建议生成环境要先做测试,之后再在生产环境升级. 1 前 ...

  6. JS基础_函数的参数

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. [JZOJ4307]喝喝喝--枚举

    [JZOJ4307]喝喝喝--枚举 题目链接 自行搜索 分析 我们需要找到所有不包含\((a_x,a_y),a_x \equiv k \mod a_y (x<y)\)这样的连续数对,转化一下变成 ...

  8. LeetCode 腾讯精选50题--二叉树中的最大路径和

    二叉树中的最大路径和 题目描述 给定一个非空二叉树,返回器最大路径和,路径指一条从任意节点出发,到达任意节点的序列,该路径至少包含一个节点,且不一定经过根节点 解题思路 树这一类数据结构我还不是很熟悉 ...

  9. javascript定义一个list

    JavaScript可以定义数组类型,在javascript语言中List叫Array,它有以下2种定义方式方式1:var array=new Array();方式2:var array=[];通常在 ...

  10. poi的基本导入

    一.获取列的值 private String getCell(Cell cell){ if(null == cell){ return ""; } try{ cell.setCel ...