結果
問題 |
No.648 お や す み
|
ユーザー |
|
提出日時 | 2018-02-24 20:32:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 320 bytes |
コンパイル時間 | 1,711 ms |
コンパイル使用メモリ | 165,376 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-13 21:14:23 |
合計ジャッジ時間 | 3,531 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; int main(){ ll n;cin>>n; ll l=1,r=3000000000; while(l!=r){ ll t=(l+r)/2; if(r-l==1)t=r; if(t*(t+1)/2<=n)l=t; else r=t-1; } if(l*(l+1)/2!=n)puts("NO"); else{ puts("YES"); printf("%lld\n",l); } }