結果
問題 |
No.2027 (1, 2, 3, …, N) 's Subset Sum
|
ユーザー |
👑 |
提出日時 | 2022-08-06 00:40:11 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 265 bytes |
コンパイル時間 | 325 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 7,168 KB |
最終ジャッジ日時 | 2024-09-15 22:33:22 |
合計ジャッジ時間 | 2,125 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
local n, s = io.read("*n", "*n") local t = {} for i = n, 1, -1 do if i <= s then table.insert(t, i) s = s - i end end for i = 1, #t do local j = #t + 1 - i if j <= i then break end t[i], t[j] = t[j], t[i] end print(#t) print(table.concat(t, " "))