結果

問題 No.648  お や す み 
ユーザー amety_um
提出日時 2018-02-11 03:46:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 61,144 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 05:41:36
合計ジャッジ時間 2,799 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 79 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cmath>

int main() {
	std::string yes = "YES";
	std::string no = "NO";
	std::string ans = "";
	std::int64_t a = 1;
	std::int64_t n = 0;
	std::cin >> n;
	ans = no;

	std::int64_t i = 2;
	/*for(i; i < INT_FAST32_MAX;i++) {
		if (n == a) {
			ans = yes;
			break;
		}
		a += i;
	}*/
	double k = 0;
	if (n < std::pow(10, 18)) {
		double x = sqrt(2 * n * 4 + 1);
		double y = 0;
		double x_p = 0;
		x_p = std::modf(x, &y);
		if (!(x_p > 0))
			ans = yes;

		k = x / 2 + 1 / 2;
	}
	std::cout << ans << std::endl;
	if (ans == yes)
		std::cout << std::to_string((std::uint64_t)k);
	//std::cout << std::to_string(i - 1);

	return 0;
}
0