結果
問題 |
No.680 作れる数
|
ユーザー |
![]() |
提出日時 | 2018-04-27 23:00:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 656 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 73,320 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 22:09:32 |
合計ジャッジ時間 | 1,282 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 10 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { int n; cin >> n; int b = 0; if (n <= 1) { b = 1; } else { for (int k = 2; k < 30; k++) { int s = (1 << k) - 1; if (s > n) continue; int t = 1 << (k - 1); while (t - 1 > 0) { s += t - 1; if (s > n) break; if (s == n) b = 1; t /= 2; } } } cout << (b ? "YES" : "NO") << endl; return 0; }