結果
問題 | No.1452 XOR×OR |
ユーザー | SSRS |
提出日時 | 2021-03-31 14:40:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 1,573 ms |
コンパイル使用メモリ | 168,964 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 15:39:14 |
合計ジャッジ時間 | 2,661 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> f; for (int i = 1; i * i <= N; i++){ if (N % i == 0){ f.push_back(i); if (i * i < N){ f.push_back(N / i); } } } long long ans = 0; for (int x : f){ int y = N / x; if ((x & y) == x){ ans += 1 << __builtin_popcount(x); } } ans /= 2; cout << ans << endl; }