結果

問題 No.3081 HQ9+
ユーザー roarisroaris
提出日時 2021-04-01 21:18:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 54,380 KB
最終ジャッジ日時 2024-12-21 05:33:03
合計ジャッジ時間 1,809 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,148 KB
testcase_01 AC 40 ms
53,084 KB
testcase_02 AC 39 ms
51,956 KB
testcase_03 AC 38 ms
52,200 KB
testcase_04 AC 37 ms
52,940 KB
testcase_05 AC 37 ms
52,880 KB
testcase_06 AC 38 ms
52,748 KB
testcase_07 AC 37 ms
52,832 KB
testcase_08 AC 38 ms
53,560 KB
testcase_09 AC 38 ms
53,252 KB
testcase_10 AC 39 ms
51,952 KB
testcase_11 AC 37 ms
52,064 KB
testcase_12 AC 37 ms
52,912 KB
testcase_13 AC 37 ms
52,096 KB
testcase_14 AC 37 ms
52,004 KB
testcase_15 AC 37 ms
51,960 KB
testcase_16 AC 38 ms
52,020 KB
testcase_17 AC 38 ms
53,112 KB
testcase_18 AC 38 ms
53,808 KB
testcase_19 AC 37 ms
52,084 KB
testcase_20 AC 39 ms
53,164 KB
testcase_21 AC 38 ms
54,056 KB
testcase_22 AC 37 ms
54,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()

if 'H' in S or '9' in S or '+' in S:
    print(-1)
    exit()
    
Q = S.count('Q')

if Q==0:
    print(-1)
    exit()
    
x = -1

for i in range(Q+1):
    if i*i==Q:
        x = i

if x==-1:
    print(-1)
    exit()

print(S[:N//x])
0