結果
問題 |
No.680 作れる数
|
ユーザー |
|
提出日時 | 2018-04-28 00:50:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 504 bytes |
コンパイル時間 | 1,542 ms |
コンパイル使用メモリ | 166,964 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 23:09:04 |
合計ジャッジ時間 | 2,234 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 1 |
ソースコード
#include <bits/stdc++.h> #define ll long long using namespace std; ll game(ll x) { ll ret = 0; while(x>0) { ret += x; x/=2; } return ret; } int main() { ll n; cin >> n; if(n==0) { cout << "YES" << endl; } ll ok = 1; ll ng = 10000000001L; while(abs(ok-ng)>1) { ll test = (ok+ng)/2; if(game(test)<=n) { ok = test; } else { ng = test; } } if(game(ok)==n) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }