結果

問題 No.638 Sum of "not power of 2"
ユーザー rgnerdplayer
提出日時 2025-05-01 02:40:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 486 bytes
コンパイル時間 3,861 ms
コンパイル使用メモリ 273,588 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-01 02:40:46
合計ジャッジ時間 4,194 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    auto solve = [&]() {
        i64 n;
        cin >> n;

        for (i64 i = 1; i < n; i++) {
            if (__builtin_popcountll(i) != 1 && __builtin_popcountll(n - i) != 1) {
                cout << i << ' ' << n - i << '\n';
                return;
            }
        }

        cout << -1 << '\n';
    };
    
    solve();
    
    return 0;
}
0