結果
問題 | No.454 逆2乗和 |
ユーザー |
👑 |
提出日時 | 2020-05-06 17:34:19 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 265 bytes |
コンパイル時間 | 320 ms |
コンパイル使用メモリ | 6,812 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 09:01:21 |
合計ジャッジ時間 | 1,496 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
local x = io.read("*n") local lim = 1000000 local ans = 0 for n = 1, lim - 1 do local v = 1 / (x + n) / (x + n) ans = ans + v end local remmin = 1 / (lim + x) local remmax = 1 / (lim - 1 + x) ans = ans + (remmin + remmax) / 2 print(string.format("%.10f", ans))