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