結果

問題 No.2030 Googol Strings
ユーザー roaris
提出日時 2022-08-06 08:05:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 81,920 KB
最終ジャッジ日時 2024-09-16 04:32:27
合計ジャッジ時間 3,185 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

for _ in range(int(input())):
    x = input()[:-1]
    y = input()[:-1]
    
    if len(x)<len(y):
        y2 = y+y
        s, a = divmod(len(y2), len(x))
        x2 = ''.join([x]*s+[x[:a]])
    else:
        x2 = x+x
        s, a = divmod(len(x2), len(y))
        y2 = ''.join([y]*s+[y[:a]])
    
    if x2==y2:
        if len(x)<len(y):
            print('Y')
        else:
            print('X')
    elif x2<y2:
        print('Y')
    else:
        print('X')
0