寒假程序翻译2.13

https://acs.jxnu.edu.cn/contest/24/board/challenge/A

ABC

描述:

Recently, the students of School 179 have developed a unique algorithm, which takes in a binary string ss as input. However, they soon found out that if some substring tt of ss is a palindrome of length greater than 1, the algorithm will work incorrectly. Can the students somehow reorder the characters of ss so that the algorithm will work correctly on the string?

(最近,179学校发展出了一个特别的算法,输入二进制字符串。它以二进制字符串 s 作为输入。然而,他们很快发现,如果 s 的某个子串 t 是长度大于 1 的回文串,则该算法将无法正常工作。学生能否以某种方式重新排序 s 的字符,以便算法在字符串上正确运行?)

A binary string is a string where each character is either 0 or 1.

(一个二进制字符串就是每个字都是1或者0

A string aa is a substring of a string bb if aa can be obtained from bb by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.

A palindrome is a string that reads the same backwards as forwards.

(字符串 a 是字符串 b 的子字符串,如果 a 可以通过从开头删除几个(可能为零或全部)字符和从结尾删除几个(可能为零或全部)字符从 b 获得。

回文是一个向后读取和向前读取相同的字符串。)

输入:

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1001≤t≤100). Description of the test cases follows.

The first line of each test case contains a single integer nn (1n1001≤n≤100) — the length of the string ss.

The second line of each test case contains the string ss of length nn consisting only of the characters 0 and 1.

(每个测试包含多个测试用例。第一行包含测试用例的数量 t (1≤t≤100)。测试用例的描述如下。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值