結果

問題 No.8081 HQ9+
コンテスト
ユーザー kit84
提出日時 2021-04-01 22:11:11
言語 Python3
(3.14.2 + numpy 2.4.0 + scipy 1.16.3)
結果
WA  
実行時間 -
コード長 319 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 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 #
raw source code

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