結果

問題 No.3081 HQ9+
ユーザー nasubi24nasubi24
提出日時 2021-04-01 21:41:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 75,868 KB
最終ジャッジ日時 2023-08-23 05:46:38
合計ジャッジ時間 3,170 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,300 KB
testcase_01 AC 71 ms
71,384 KB
testcase_02 AC 75 ms
71,108 KB
testcase_03 AC 71 ms
71,328 KB
testcase_04 AC 74 ms
71,096 KB
testcase_05 AC 73 ms
71,296 KB
testcase_06 AC 72 ms
71,284 KB
testcase_07 AC 72 ms
71,188 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 73 ms
71,192 KB
testcase_13 AC 73 ms
71,300 KB
testcase_14 AC 76 ms
75,528 KB
testcase_15 AC 73 ms
71,092 KB
testcase_16 AC 74 ms
75,860 KB
testcase_17 AC 73 ms
70,916 KB
testcase_18 AC 72 ms
71,276 KB
testcase_19 AC 73 ms
71,316 KB
testcase_20 AC 80 ms
75,868 KB
testcase_21 AC 79 ms
75,632 KB
testcase_22 AC 77 ms
75,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=input()
if s.count("Q")==1 and s.count("H")==0 and s.count("9")==0:
    print(s)
elif s.count("Q")!=0:
    for i in range(2,n+1):
        if n%i==0:
            for j in range(n//i):
                if s[(n//i)*j:(n//i)*(j+1)]!=s[(n//i)*(j+1):(n//i)*(j+2)]:
                    break
            else:
                print(s[:(n//i)])
                break
    else:
        print(-1)
else:
    print(-1)
0