結果

問題 No.638 Sum of "not power of 2"
ユーザー phspls
提出日時 2020-05-03 10:51:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 1,438 ms
コンパイル使用メモリ 166,952 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 16:06:45
合計ジャッジ時間 1,977 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long

bool notP2(int val) {
    rep(i, 18) {
        if(1 << i == val) return false; 
    }
    return true;
}

int main() {
    llong n;
    cin >> n;
    if(n <= 5) {
        cout << -1 << "\n";
    } else if(notP2(n-3)) {
        cout << 3 << " " << n-3 << "\n";
    } else if(notP2(n-5)) {
        cout << 5 << " " << n-5 << "\n";
    } else {
        cout << -1 << "\n";
    }
}
0