結果

問題 No.2358 xy+yz+zx=N
ユーザー 👑 obakyanobakyan
提出日時 2023-07-16 00:06:14
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 664 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 6,364 KB
最終ジャッジ日時 2023-10-17 10:07:42
合計ジャッジ時間 5,141 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 664 ms
6,244 KB
testcase_09 AC 658 ms
6,364 KB
testcase_10 AC 647 ms
4,348 KB
testcase_11 AC 650 ms
4,464 KB
testcase_12 AC 495 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local mfl, mce = math.floor, math.ceil
local n = io.read("*n")
local ans = {}
for x = 0, n do
  for y = 0, n do
    if n < x * y then break end
    if 0 < x + y then
      local rem = n - x * y
      if rem % (x + y) == 0 then
        local z = mfl(rem / (x + y))
        table.insert(ans, x .. " " .. y .. " " .. z)
      end
    end
  end
end
print(#ans)
print(table.concat(ans, "\n"))
0