結果
| 問題 |
No.638 Sum of "not power of 2"
|
| コンテスト | |
| ユーザー |
fushime2
|
| 提出日時 | 2018-01-26 23:18:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 906 bytes |
| コンパイル時間 | 1,829 ms |
| コンパイル使用メモリ | 157,276 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 02:27:51 |
| 合計ジャッジ時間 | 2,374 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }
ll n;
bool C(ll x) {
ll a = 1;
while (a <= x) {
if (x == a) return true;
a *= 2;
}
return false;
}
void solve(ll n) {
for (ll i = 1; i <= n; i++) {
if (i > n - i) break;
if (!C(i) && !C(n - i)) {
printf("%lld %lld\n", i, n - i);
return;
}
}
puts("-1");
}
int main() {
//FOR(i, 1, 23) {
// solve(i);
//}
//solve(ll(1e18));
ll n; cin >> n;
solve(n);
return 0;
}
fushime2