結果
問題 | No.638 Sum of "not power of 2" |
ユーザー |
![]() |
提出日時 | 2018-03-01 11:17:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 621 bytes |
コンパイル時間 | 687 ms |
コンパイル使用メモリ | 74,324 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 04:42:35 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include<iostream> #include<vector> #include<bitset> #include<algorithm> #include<cmath> #include<string> using namespace std; long long table[61]; void lo2(){ table[0] = 1; for(int i=1;i<=60;i++){ table[i] = table[i-1]*2; } } bool check(long long num){ for(int i=0;i<=60;i++){ if(table[i]==num) return false; } return true; } int main(){ long long N; cin >> N ; lo2(); for(long long i=3;i<=N/2;i++){ if(check(i)&&check(N-i)){ cout << i << ' ' << N-i << endl; return 0; } } cout << -1 << endl; return 0; }