結果

問題 No.648  お や す み 
ユーザー shioya
提出日時 2018-07-25 23:23:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,511 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 55,944 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 22:29:07
合計ジャッジ時間 34,353 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int main()
{
    long long int n,cnt_sheep;
    bool sleep_flg = false;
    cnt_sheep = 0;
    cin>>n;
    for(int i=0;cnt_sheep<n;i++){
        cnt_sheep +=i;
        if(cnt_sheep == n){
            cout<<"YES"<<endl;
            cout<<i<<endl;
            sleep_flg = true;
        }
    }
    if(!sleep_flg)cout<<"NO"<<endl;
    return 0;
}
0