結果
問題 |
No.648 お や す み
|
ユーザー |
|
提出日時 | 2023-02-21 15:35:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 985 ms |
コンパイル使用メモリ | 87,508 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 02:39:47 |
合計ジャッジ時間 | 3,157 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
#include <iostream> #include <stdio.h> #include <string.h> #include <vector> #include <string> #include <set> #include <map> #include <algorithm> #include <numeric> #include <queue> #include <cassert> #include <cmath> #include <bitset> using namespace std; int main() { long long n; cin >> n; long long ok = 1; long long ng = 2e9; while (ok+1 < ng) { long long x = (ok+ng)/2; if (x*(x+1) <= n*2) ok = x; else ng = x; } if (ok*(ok+1) == n*2) cout << "YES\n" << ok << endl; else cout << "NO" << endl; }