結果

問題 No.1452 XOR×OR
ユーザー DaYuanChi
提出日時 2021-04-04 00:07:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 1,374 ms
コンパイル使用メモリ 167,776 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 15:43:35
合計ジャッジ時間 2,270 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
  int n; cin >> n;
  int ans = 0;
  for(int i = 1; i*i <= n; i++){
    int ret = 0;
    if(n%i==0){
      ret = 1;
      int a = i;
      int b = n/i;
      for(int j = 30; j >= 0; j--){
        int A = (a>>j)&1;
        int B = (b>>j)&1;
        if(A==0 && B==0) ret *= 1;
        if(A==0 && B==1) ret *= 1;
        if(A==1 && B==0) ret *= 0;
        if(A==1 && B==1) ret *= 2;
      }
    }
    ans += ret;
  }
  ans /= 2;   
  cout << ans << endl;
  return 0;
}
0