結果

問題 No.8081 HQ9+
ユーザー 👑 obakyan
提出日時 2022-04-17 22:35:53
言語 Lua
(LuaJit 2.1.1734355927)
結果
WA  
実行時間 -
コード長 281 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 11:31:22
合計ジャッジ時間 1,703 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read("*n", "*l")
local s = io.read()
for i = 1, n do
  if s:sub(i, i) ~= "Q" then
    print(-1) os.exit()
  end
end
z = math.sqrt(n)
if z * z == n then
  print(string.rep("Q", z))
elseif (z + 1) * (z + 1) == n then
  print(string.rep("Q", z + 1))
else
  print(-1)
end
0