結果
| 問題 | No.2027 (1, 2, 3, …, N) 's Subset Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-06 00:40:11 |
| 言語 | Lua (LuaJit 2.1.1774638290) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 265 bytes |
| 記録 | |
| コンパイル時間 | 130 ms |
| コンパイル使用メモリ | 6,400 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2026-04-05 02:18:52 |
| 合計ジャッジ時間 | 1,409 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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, " "))