結果
問題 | No.638 Sum of "not power of 2" |
ユーザー |
|
提出日時 | 2018-05-08 01:36:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 1,560 ms |
コンパイル使用メモリ | 158,104 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 02:25:55 |
合計ジャッジ時間 | 2,042 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { unsigned long N; int ans; cin >> N; if(N < 6 || N == 7) ans = -1; else { N -= 3; if((N & N-1)==0) { N -= 2; if((N & N-1)==0) ans = -1; else ans = 5; } else ans = 3; } if(ans == -1) cout << ans << '\n'; else cout << ans << " " << N << '\n'; return 0; }