結果
問題 |
No.8081 HQ9+
|
ユーザー |
👑 |
提出日時 | 2022-04-17 22:38:27 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 371 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 11:31:36 |
合計ジャッジ時間 | 1,077 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 WA * 4 |
ソースコード
local n = io.read("*n", "*l") local s = io.read() y = 0 for i = 1, n do if s:sub(i, i) == "H" then print(-1) os.exit() end if s:sub(i, i) == "Q" then y = y + 1 end end if y == 0 then print(-1) os.exit() end z = math.sqrt(y) if z * z == y then print(string.rep(s, z)) elseif (z + 1) * (z + 1) == y then print(string.rep(s, z + 1)) else print(-1) end