結果

問題 No.8081 HQ9+
ユーザー kit84kit84
提出日時 2021-04-01 22:11:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-12-21 06:27:51
合計ジャッジ時間 1,589 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

#N,M = map(int,input().split())
#print(N)

N = int(input())
S = input().rstrip()

if S.count("Q")==1 and \
   "H" not in S and \
   "9" not in S:
	print(S)
elif S.count("Q")==N:
	m = 0
	n = 1
	while m*m < N:
		m += 1
	if m*m==N:
		print("Q"*m)
	else:
		print(-1)
else:
	print(-1)
0