結果
問題 | No.648 お や す み |
ユーザー |
|
提出日時 | 2018-02-09 22:39:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 885 ms |
コンパイル使用メモリ | 67,420 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 20:57:39 |
合計ジャッジ時間 | 2,892 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
#include <iostream>#include <cmath>using namespace std;int main() {long long n;cin >> n;n *= 2;long long sec = sqrt(n);bool ok = false;while (1) {// long long sheep = sec * (sec + 1) / 2;long long sheep = sec * (sec + 1);if (sheep >= n) {ok = sheep == n;break;}sec++;}if (ok) {cout << "YES" << endl;cout << sec << endl;} else {cout << "NO" << endl;}return 0;}