結果

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

ソースコード

diff #

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

 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;

	while(t--){
		int n;
		cin>>n;
		int ans=0;
		for(int i=1;i*i<=n;i++){
			if(n%i==0){
				int x=n/i;
				int y=i;
				int cnt=1;
				for(int j=0;j<30;j++){
					if(((x >> j) & 1) && ((y >> j) & 1)){
						cnt=cnt*2;
					}
					if(((y>>j)&1)&&(!((x>>j)&1))){
						cnt=0;
					}
				}
				ans+=cnt;

			}
		}
		cout<<ans/2<<"\n";
	}
}
0