結果

問題 No.648  お や す み 
ユーザー CELICA
提出日時 2020-09-02 06:05:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 166,976 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 14:00:21
合計ジャッジ時間 3,686 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	ll n;
	cin >> n;

	ll sec = (ll)sqrt(n * 2);
	ll nn = sec * (sec + 1) / 2;

	string res = n == nn ? "YES\n" + to_string(sec) : "NO";
	cout << res << "\n";

	return 0;
}
0