結果
問題 |
No.648 お や す み
|
ユーザー |
![]() |
提出日時 | 2018-02-11 03:51:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 676 bytes |
コンパイル時間 | 898 ms |
コンパイル使用メモリ | 61,272 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 06:16:05 |
合計ジャッジ時間 | 2,686 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 WA * 19 |
ソースコード
#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 < (2 * 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; }