結果
問題 |
No.2853 A + B Problem
|
ユーザー |
|
提出日時 | 2024-08-25 18:17:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 914 ms |
コンパイル使用メモリ | 84,688 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-25 18:17:47 |
合計ジャッジ時間 | 2,145 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#pragma GCC optimize("O2") #ifdef local #include <C++/core/io/debug_print.hpp> #else #define dump(...) void(0); #endif #include <iostream> #include <cstdint> #include <bit> namespace man { constexpr inline int64_t pow2(int m) noexcept { int64_t base = 2, ret = 1; while(m) { if(m & 1) { ret *= base; } base *= base; m >>= 1; } return ret; } } int main() { std::cin.tie(nullptr) -> sync_with_stdio(false); uint64_t n; std::cin >> n; const int m = std::popcount(n); std::cout << man::pow2(m) - 2 << '\n'; }