結果
| 問題 | No.1452 XOR×OR | 
| コンテスト | |
| ユーザー |  hitonanode | 
| 提出日時 | 2021-05-13 16:20:50 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 532 bytes | 
| コンパイル時間 | 529 ms | 
| コンパイル使用メモリ | 66,348 KB | 
| 最終ジャッジ日時 | 2025-01-21 10:35:19 | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 36 | 
ソースコード
#include <iostream>
using namespace std;
int main() {
    int N;
    cin >> N;
    long long ret = 0;
    for (int l = 1; l * l <= N; l++) {
        int r = N / l;
        if (r * l == N) {
            const int AandB = r - l;
            const int AplusB = AandB + r;
            const int AxorB = AplusB - AandB * 2;
            if (AxorB >= 0 and ((AandB & AxorB) == 0)) {
                int n = __builtin_popcount(AxorB);
                ret += n ? (1 << (n - 1)) : 1;
            }
        }
    }
    cout << ret << '\n';
}
            
            
            
        