結果
問題 | No.638 Sum of "not power of 2" |
ユーザー |
![]() |
提出日時 | 2019-03-23 21:02:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 930 ms |
コンパイル使用メモリ | 75,832 KB |
最終ジャッジ日時 | 2025-01-07 00:27:05 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include<iostream> #include<set> typedef long long ll; int main(int argc, char const *argv[]) { ll n; std::cin >> n; std::set<ll> s; for (ll x = 0; ; x++) { ll t = 1LL << x; if (n < t) break; s.insert(t); } for (ll a = 1; a < n; a++) { ll b = n - a; if (s.count(a) == 0 && s.count(b) == 0) { std::cout << a << " " << b << std::endl; return 0; } } std::cout << -1 << std::endl; }