結果
| 問題 | No.648 お や す み |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-26 15:03:20 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 644 bytes |
| 記録 | |
| コンパイル時間 | 1,177 ms |
| コンパイル使用メモリ | 186,896 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-26 15:03:33 |
| 合計ジャッジ時間 | 3,675 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 79 WA * 5 |
ソースコード
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <algorithm>
#include <numeric>
using namespace std;
const double INF = 2e9;
const double EPS = 1e-8;
int main()
{
long long n;
cin >> n;
long long L = 0, R = 1000000000;
while (R - L > 1)
{
long long M = (R + L) / 2;
if (M * (M + 1) <= 2 * n)
{
L = M;
}
else
{
R = M;
}
}
if (L * (L + 1) == 2 * n)
{
cout << "YES" << endl;
cout << L << endl;
}
else
{
cout << "NO" << endl;
}
}