結果
問題 |
No.638 Sum of "not power of 2"
|
ユーザー |
![]() |
提出日時 | 2025-04-11 00:36:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 623 bytes |
コンパイル時間 | 3,187 ms |
コンパイル使用メモリ | 273,692 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-11 00:36:04 |
合計ジャッジ時間 | 4,202 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline bool is_2beki(ll n) { if (n == 0) return false; while (n % 2 == 0) n /= 2; return n == 1; } int main() { cin.tie(nullptr)->sync_with_stdio(false); ll n; cin >> n; for (ll i = 1; i <= 1000; ++i) { if (n - i <= 0) break; if (is_2beki(i) || is_2beki(n - i)) continue; cout << i << ' ' << n - i << '\n'; return 0; } cout << -1 << '\n'; return 0; }