当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7220:Theramore

题目描述
$\space \space$*Those blood-soaked shores of Kalimdor is like a ghost haunting Jaina Proudmoore ever since the day she pushed her father into hell.*

$\space \space$*Now, standing in front of the devastated ruins of Theramore, she knew how naive she had been to want peace.*

$\space \space$*The Focusing Iris. It was the most brutal and cowardly killing method Jaina could imagine.*

$\space \space$*The Horde wants war. They will do anything to destroy us. But if this is all they want, Jaina will be pleased to offer them a big one.*


The warships of the Horde can be described as a string $s$ which contains only '0' and '1', denoting the small warship and the large warship. Jaina can perform some magic to the string. In one magic, she chooses an arbitrary interval with odd length and reverse it. Jaina can perform this magic as many times as she likes.

Jaina wants the small warships to be in the front, since they are easier to destroy. She asks for your help, and you need to tell her the lexicographically smallest string that she can obtain.

Note: in this problem, suppose two sequences $s$ and $t$ both have length $n$, then $s$ is lexicographically smaller than $t$ if there exists a position $i(1\leq i\leq n)$ such that $s_j = t_j$ for all $1\leq j < i$ and $s_i='0',t_i='1'$.
输入解释
The input consists of multiple test cases.

The first line contains an integer $T\ (1\leq T \leq 10)$ denoting the number of test cases.

Each test case consists of only one line containing a string $s\ (|s| \leq 10^5)$.
输出解释
Output one line containing the lexicographically smallest string that you can get.
输入样例
2
101001
01101100000000101010
输出样例
001011
00000000001010101111
来自杭电HDUOJ的附加信息
Hint In the first test case, Jaina performs magic to the interval $[3,5]$ and the string is changed to $100011$. Then Jaina performs magic to the interval $[1,3]$ and the string is changed to $001011$.

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7220

最后修改于 2022-09-15T06:17:28+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)