結果

問題 No.638 Sum of "not power of 2"
ユーザー AqFv
提出日時 2018-01-26 23:22:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 62,372 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-30 02:28:43
合計ジャッジ時間 1,339 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#define rep(i, a, n) for(long long int i = a;i < n;i++)
using namespace std;


long long int n;


bool judge(long long int a){
	return !(log2(a) - (int)log2(a) < 0.0000000001);
}


long long int solve(){
	rep(a, 3, n-2){
		long long int b = n - a;
		if(judge(a) && judge(b)) return a;
	}
	return -1;
}


int main(){
	cin >> n;

	long long int a = solve();

	if(a == -1) cout << a << endl;
	else cout << min(a, n-a) << ' ' << max(a, n-a) << endl;

	return 0;
}
0