結果
問題 |
No.2479 Sum of Squares
|
ユーザー |
👑 |
提出日時 | 2024-08-14 13:36:50 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 5,632 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-08-14 13:36:51 |
合計ジャッジ時間 | 1,727 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
local mfl, mce = math.floor, math.ceil local ffi = require("ffi") local C = ffi.C ffi.cdef[[ long long atoll(const char*); ]] local function lltonumber(str) return C.atoll(str) end local n = io.read() n = lltonumber(n) local t = {} while 0LL < n do local left, right = 1, 1000000007-6 while 1 < right - left do local mid = mfl((left + right) / 2) local v = 1LL * mid * mid if v <= n then left = mid else right = mid end end local z = 1LL * left * left n = n - z z = tostring(z):gsub("LL", "") table.insert(t, z) end print(#t) print(table.concat(t, " "))