結果

問題 No.648  お や す み 
ユーザー nnasen
提出日時 2018-02-10 02:31:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 1,653 ms
コンパイル使用メモリ 167,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 21:06:16
合計ジャッジ時間 3,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	LL n;
	cin >> n;
	bool bo = false;
	LL a = sqrt(2 * n);
	if (2 * n == a * (a + 1))
		bo = true;
	if (bo) {
		cout << "YES" << endl;
		cout << a << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}
0