結果
問題 | No.254 文字列の構成 |
ユーザー |
👑 |
提出日時 | 2020-04-20 23:04:30 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-06 09:34:05 |
合計ジャッジ時間 | 4,581 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 WA * 27 |
ソースコード
local n = io.read("*n") local p = 1 local s = {"ab", "cd", "ef"} local t = {"a", "c", "e"} while 0 < n do local a = 1 for i = 1, n do local v = i * 2 - 1 + i * (i - 1) / 2 if n < v then break end a = i end if 1 < a then io.write(string.rep(s[p], a - 1)) io.write(t[p]) n = n - a * 2 + 1 - a * (a + 1) / 2 else io.write(t[p]) n = n - 1 end p = p + 1 if p == 4 then p = 1 end end io.write("\n")