2025夏-A-1 Walnut Numbers
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
题目描述
A positive integer is called a "walnut number", if there exists 3 identical consecutive bits in its binary representation. However, it does not count if there are more than 3 identical consecutive bits. For example, 111000 and 1110111 are both walnut numbers, while 1111 and 10000 are not. Your job is to write a program to check if a given positive number is a walnut number.
输入格式
Each input file contains several test cases. The first line gives a positive integer (), which is the number of cases. Then lines follow, each gives a positive number which is no more than .
输出格式
For each case, print in a line yes
if the input number is a walnut number, or no
if not.
样例
5
56
119
15
16
3870
yes
yes
no
no
yes
限制
对于所有的测试用例,限制为400ms, 64MB