链接:

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. hanlp分词工具应用案例:商品图自动推荐功能的应用

    本篇分享一个hanlp分词工具应用的案例,简单来说就是做一图库,让商家轻松方便的配置商品的图片,最好是可以一键完成配置的. 先看一下效果图吧: 商品单个推荐效果:匹配度高的放在最前面 这个想法很好,那 ...

  2. oracle——学习之路(select检索)

    select语法: select   [distinct|all]    列名     from   表名     [where]   [group by]   [having]    [order ...

  3. base64转码java版

    package com.net.util; import java.io.FileInputStream; import java.io.FileOutputStream; import java.i ...

  4. adb shell dumpsys [options]的使用

    adb shell dumpsys [options]该命令用于打印出当前系统信息,默认打印出设备中所有service的信息.由于service比较多,这里选几个用的比较多的service来进行讲解: ...

  5. Python多线程VS多进程

  6. OBB碰撞

    OBB碰撞检测,坐标点逆时针 class OBBTest extends egret.DisplayObjectContainer { private obb1:OBB; private obb2:O ...

  7. kubernetes kubeadm安装v1.14

    1.我们这里准备两台Centos7的主机用于安装,后续节点可以根究需要添加即可:master node01两台都得改:cat /etc/hosts192.168.71.134 master192.16 ...

  8. gdb暂停或恢复程序的运行

    ref : https://blog.csdn.net/seu_lyr/article/details/9050657   一 暂停程序的运行: (一)GDB的暂停方式:断点(BreakPoint). ...

  9. python+django学习一

    pycharm破解地址:https://blog.csdn.net/qq_32811489/article/details/78636049 按照视频写代码,记录关键的地方方便自己记忆, 视频教程地址 ...

  10. mvc 登陆界面+后台代码

    上代码 前端+js(懒得分文件了) @{ ViewBag.Title = "MVC权限系统架构学习-登录"; Layout = "/Views/Shared/_LoadJ ...