結果
| 問題 |
No.589 Counting Even
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-06-26 21:02:40 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 362 bytes |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 5,120 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 10:34:50 |
| 合計ジャッジ時間 | 1,312 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
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 z = n
local mul = 1LL
while 0LL < z do
if z % 2LL == 1LL then mul = mul * 2LL end
z = z / 2LL
end
local ans = n + 1 - mul
ans = tostring(ans):gsub("LL", "")
print(ans)