結果

問題 No.648  お や す み 
ユーザー mlpj56d
提出日時 2018-02-22 06:15:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 948 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 55,848 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-13 21:14:10
合計ジャッジ時間 22,993 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<stdio.h>
using namespace std;
int main (){
    long long int n,sum=0;
    cin >> n;
    for(int i=0; sum <= n; i++){
        sum += i;
        if( sum == n ) {
            cout << "YES" << endl;
            cout << i << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}
0