网易有道笔试8.3

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_18310041/article/details/98475031

第四题:

很奇怪不知道为何测试通过了,AC-0%,求解??

#coding=utf-8
# 本题为考试单行多行输入输出规范示例,无需提交,不计分。
import sys 
n = int(sys.stdin.readline().strip())
for _ in range(n):
    s = sys.stdin.readline().strip()
    t = sys.stdin.readline().strip()

    if s == '' or t == '':
        print('NO')
    else:
        add = s+s

        x = ''  
        f = 0
        for i in add:
            if i == '0':
                f = 1
                x += '1'
            elif f == 1:
                x += '0'

        if t in add or t in x:
            print('YES')
        else:
            print('NO')

猜你喜欢

转载自blog.csdn.net/qq_18310041/article/details/98475031