結果

問題 No.648  お や す み 
ユーザー totori_nyaa
提出日時 2019-07-17 22:20:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 165,672 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 11:51:58
合計ジャッジ時間 5,117 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 53 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    ll n;
    cin>>n;
    long long low=-1,up=2e9+7,mid;
    while(up-low>1){
        mid=(up+low)/2;
        if(mid*(mid+1)<=n*2){
            low=mid;
        }
        else{
            up=mid;
        }
    }

    if(low*(low+1)==2*n){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
}
0