結果
問題 |
No.648 お や す み
|
ユーザー |
![]() |
提出日時 | 2018-02-09 22:31:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 645 ms |
コンパイル使用メモリ | 69,676 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 20:45:20 |
合計ジャッジ時間 | 2,554 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
#include<algorithm> #include<iostream> #include<vector> using namespace std; typedef long long lint; typedef vector<int>vi; typedef pair<int,int>pii; #define rep(i,n)for(int i=0;i<(int)(n);++i) int main(){ lint n; cin>>n; lint p=2e9,f=0; while(p-f>1){ lint x=(p+f)/2; if(x*(x+1)>=2*n)p=x; else f=x; } if(p*(p+1)==2*n){ cout<<"YES\n"<<p<<endl; }else{ cout<<"NO\n"; } }