結果
問題 | No.638 Sum of "not power of 2" |
ユーザー |
![]() |
提出日時 | 2018-01-26 22:21:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 943 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 02:14:51 |
合計ジャッジ時間 | 1,748 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <map> #include <functional> #include <cmath> #include <tuple> using namespace std; #pragma warning (disable: 4996) long long n; bool ispower(long long H) { while (H >= 2) { if (H % 2 == 1) return false; H /= 2; } return true; } int main() { cin >> n; for (long long i = 1; i <= n - 1; i++) { if (ispower(i) == false && ispower(n - i) == false) { cout << i << " " << n - i << endl; return 0; } } cout << "-1" << endl; return 0; }