結果

問題 No.1452 XOR×OR
ユーザー kotatsugamekotatsugame
提出日時 2021-03-31 15:13:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 63,488 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 15:40:08
合計ジャッジ時間 1,610 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N;
long ans;
long calc(int x)
{
	int T=N/x;
	if(~T&x)return 0;
	return 1<<__builtin_popcount(x)-1;
}
main()
{
	cin>>N;
	for(int i=1;i*i<=N;i++)if(N%i==0)
	{
		ans+=calc(i);
		if(i<N/i)ans+=calc(N/i);
	}
	cout<<ans<<endl;
}
0