# CF976A Minimum Binary Number

• 94通过
• 176提交
• 题目来源
• 评测方式 RemoteJudge
• 标签 字符串 概率论,统计
• 难度 入门难度
• 时空限制 1000ms / 256MB
• 提示：收藏到任务计划后，可在首页查看。

## 题目描述

给定一个二进制数（没有多余前导0），可以对这个二进制数执行两种操作：

1. 交换相邻数位的数字；
2. 用 1 代替 11（例如 110 变成 10）。

输出执行任意操作（或者不操作）后这些二进制数中最小的二进制数。

## 输入格式

第一行，一个数 n，表示这个二进制数的长度；

第二行，一个二进制数 s。

## 输出格式

执行任意操作后最小的二进制数；

## 样例解释

样例一解释：1001->1010->1100->100

样例二解释：不用操作

## 题目描述

String can be called correct if it consists of characters "0" and "1" and there are no redundant leading zeroes. Here are some examples: "0", "10", "1001".

You are given a correct string $s$ .

You can perform two different operations on this string:

1. swap any pair of adjacent characters (for example, "101" "110");
2. replace "11" with "1" (for example, "110" "10").

Let $val(s)$ be such a number that $s$ is its binary representation.

Correct string $a$ is less than some other correct string $b$ iff $val(a)<val(b)$ .

Your task is to find the minimum correct string that you can obtain from the given one using the operations described above. You can use these operations any number of times in any order (or even use no operations at all).

## 输入输出格式

输入格式：

The first line contains integer number $n$ ( $1<=n<=100$ ) — the length of string $s$ .

The second line contains the string $s$ consisting of characters "0" and "1". It is guaranteed that the string $s$ is correct.

输出格式：

Print one string — the minimum correct string that you can obtain from the given one.

## 输入输出样例

输入样例#1： 复制
4
1001

输出样例#1： 复制
100

输入样例#2： 复制
1
1

输出样例#2： 复制
1


## 说明

In the first example you can obtain the answer by the following sequence of operations: "1001" "1010" "1100" "100".

In the second example you can't obtain smaller answer no matter what operations you use.

提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。