結果

問題 No.634 硬貨の枚数1
ユーザー 👑 obakyan
提出日時 2019-06-04 22:21:39
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-17 20:51:35
合計ジャッジ時間 4,466 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 75
権限があれば一括ダウンロードができます

ソースコード

diff #

local mfl = math.floor
local n = io.read("*n")
local t = {}
local max = 4471
local f = false
for i = 1, max do
  t[i] = mfl(i * (i + 1) / 2)
  if t[i] == n then f = true print(1) break end
end
if not f then
  for i = 1, max do for j = 1, max do
    if t[i] + t[j] == n then print(2) f = true break end
  end if f then break end end
end
if not f then print(3) end
0