英文题面翻译20

英文题目:题目来源: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?

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

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.

输入:

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

The first line of each test case contains a single integer nn (1≤n≤1001≤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.

输出:

For each test case, print YES (case-insensitive) if it is possible to reorder the characters of ss so that there are no substrings that are a palindrome of length greater than 1, or NO (case-insensitive) otherwise.

翻译:

ABC

描述:

最近,179学校的学生设计了一个输入二进制一个字符串的程序。但是他们发现当他们输入的s字符串的某个子字符串是长度大于一的回文时就会出现故障。学生们能否以某种方式重新排列s的字符,以便算法能正确地处理字符串?
二进制字符串是每个字符为0或1的字符串。
如果a可以通过删除开头的几个(可能是零或全部)字符和结尾的几个(可能是零或全部)字符从b中获得,那么就称字符串a是字符串b的子字符串。
回文是一个前后都读相同的字符串。

输入:

测试包含多组数据

第一行输入一个整数表示一共有t(1≤t≤100)组数据

接下来每组数据

第一行输入一个整数表示该字符串的长度

第二行输入该字符串s。

输出:

对于每组数据可以变形实现程序输出YES否则输出NO。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值