結果
問題 | No.1452 XOR×OR |
ユーザー |
![]() |
提出日時 | 2021-03-31 15:16:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 893 bytes |
コンパイル時間 | 3,473 ms |
コンパイル使用メモリ | 198,040 KB |
最終ジャッジ日時 | 2025-01-20 01:49:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
#include "bits/stdc++.h" #define int long long using namespace std; using ll = long long; using P = pair<ll, pair<ll, ll>>; const ll INF = (1LL << 61); ll mod = 1000000007; vector<ll> enum_divisors(ll N) { vector<ll> res; for (ll i = 1; i * i <= N; i++) { if (N % i == 0) { res.push_back(i); if (N / i != i)res.push_back(N / i); } } sort(res.begin(), res.end()); return res; }int beki[40]; signed main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; int now = 1; for (int i = 0; i < 40; i++) { beki[i] = now; now *= 2; } int ans = 0; for (ll i = 1; i * i <= N; i++) { if (N % i == 0) { int now = i, now2 = N / i; if ((now | now2) != now2)continue; int t = (now & now2); int cnt = 0; for (int j = 0; j < 40; j++) { if (t >> j & 1)cnt++; } if (cnt == 0)continue; ans += beki[cnt - 1]; } } cout << ans << endl; return 0; }