結果

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

ソースコード

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 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;

	double 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);
	std::cin >> n;

	return 0;
}
0