結果
問題 | No.8081 HQ9+ |
ユーザー |
![]() |
提出日時 | 2021-04-01 22:42:47 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 362 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-21 06:56:26 |
合計ジャッジ時間 | 1,540 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
import sysinput = sys.stdin.readline#N,M = map(int,input().split())#print(N)N = int(input())S = input().rstrip()nQ = S.count("Q")if "H" in S or \"9" in S:print(-1)elif nQ==1:print(S)elif nQ>1:m = 0while m*m < nQ:m += 1if m*m==nQ:T = S[:(N//m)]if T*m == S:print(T)else:print(-1)else:print(-1)else:print(-1)