結果
| 問題 | No.638 Sum of "not power of 2" | 
| コンテスト | |
| ユーザー |  tetsuzuki1115 | 
| 提出日時 | 2018-02-14 04:05:24 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 692 bytes | 
| コンパイル時間 | 867 ms | 
| コンパイル使用メモリ | 79,080 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-16 02:40:23 | 
| 合計ジャッジ時間 | 1,728 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
bool is2pow( long long a ) {
    int cnt = 0;
    for ( int i = 0; i < 32; i++ ) {
        if ( (1<<i)&a ) { cnt++; }
    }
    return cnt == 1;
}
int main() {
    long long N;
    cin >> N;
    for ( long long i = 3; i < N; i++ ) {
        if ( !is2pow(i) && !is2pow(N-i) ) {
            cout << i << " " << N-i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}
            
            
            
        