結果

問題 No.3088 XOR = SUM
ユーザー kotatsugame
提出日時 2025-04-04 21:33:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 1,386 ms
コンパイル使用メモリ 60,544 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-04-04 21:36:37
合計ジャッジ時間 15,302 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int T;cin>>T;
	for(;T--;)
	{
		long long N;cin>>N;
		long long X=0,Y=0;
		for(int k=0;k<60;k++)
		{
			long long x=1LL<<k;
			if(x>N)break;
			long long y=min(N-x,x-1);
			if((__int128)X*Y<(__int128)x*y)X=x,Y=y;
		}
		cout<<X<<" "<<Y<<"\n";
	}
}
0