結果

問題 No.3081 HQ9+
ユーザー googol_S0googol_S0
提出日時 2021-04-01 21:30:59
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 77,316 KB
最終ジャッジ日時 2023-08-23 05:36:49
合計ジャッジ時間 3,255 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,184 KB
testcase_01 AC 68 ms
71,420 KB
testcase_02 AC 69 ms
71,372 KB
testcase_03 AC 69 ms
71,120 KB
testcase_04 AC 69 ms
71,236 KB
testcase_05 AC 69 ms
71,384 KB
testcase_06 AC 69 ms
71,428 KB
testcase_07 AC 69 ms
71,384 KB
testcase_08 AC 76 ms
76,456 KB
testcase_09 AC 71 ms
71,544 KB
testcase_10 AC 70 ms
71,364 KB
testcase_11 AC 69 ms
71,340 KB
testcase_12 AC 68 ms
71,432 KB
testcase_13 AC 72 ms
75,820 KB
testcase_14 AC 78 ms
76,620 KB
testcase_15 AC 75 ms
76,664 KB
testcase_16 AC 79 ms
76,488 KB
testcase_17 AC 78 ms
76,624 KB
testcase_18 AC 88 ms
77,284 KB
testcase_19 AC 77 ms
76,780 KB
testcase_20 AC 113 ms
76,988 KB
testcase_21 AC 110 ms
77,316 KB
testcase_22 AC 112 ms
77,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
  if 'H' in x:
    return 1000000
  if '9' in x:
    return 1000000
  return x.count('Q')

N=int(input())
S=input()
for i in range(1,N+1):
  if N%i:
    continue
  F=1
  for j in range(i,N,i):
    for k in range(i):
      if S[k]!=S[j+k]:
        F=0
  if F:
    if f(S[:i])*i==N:
      print(S[:i])
      exit()
print(-1)
0