結果

問題 No.1452 XOR×OR
ユーザー 👑 Nachia
提出日時 2021-03-31 15:39:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 1,923 ms
コンパイル使用メモリ 190,340 KB
最終ジャッジ日時 2025-01-20 01:56:58
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;

int two_to_popcount(int x){
  int res=1;
  rep(d,30) res*=((x>>d)&1)+1;
  return res;
}

int main(){
  cin>>N;
  int ans=0;
  for(int i=1; i*i<=N; i++){
    int AxorB = i, AorB = N/i;
    if(AxorB*AorB!=N) continue;
    if((AorB&AxorB) == AxorB) ans+=two_to_popcount(AxorB)/2;
  }
  cout<<ans<<"\n";
  return 0;
}
0