結果
問題 | No.2853 A + B Problem |
ユーザー | Tatsu_mr |
提出日時 | 2024-08-25 13:51:57 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 2,185 ms |
コンパイル使用メモリ | 201,840 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-25 13:52:03 |
合計ジャッジ時間 | 2,921 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b) { long long cur = a, ans = 1; for (int i = 0; i < 60; i++) { if (b & (1LL << i)) { ans = (ans * cur); } cur = (cur * cur); } return ans; } using lint = long long; int main() { lint n; cin >> n; lint cnt = __builtin_popcountl(n); cout << (cnt < 2 ? 0 : power(2LL, cnt) - 2LL) << endl; }