結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    unsigned long long N;
    cin >> N;

    unsigned long long a = floor(sqrt(8*N+1));
    if ( a*a == 8*N+1 ) {
        cout << "YES" << endl;
        cout << (a-1)/2 << endl;
    }
    else { cout << "NO" << endl; }

    return 0;
}
0