結果
| 問題 | No.648 お や す み |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-21 15:35:44 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 529 bytes |
| 記録 | |
| コンパイル時間 | 614 ms |
| コンパイル使用メモリ | 103,476 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-03 07:01:30 |
| 合計ジャッジ時間 | 6,004 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 84 |
ソースコード
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cassert>
#include <cmath>
#include <bitset>
using namespace std;
int main() {
long long n;
cin >> n;
long long ok = 1;
long long ng = 2e9;
while (ok+1 < ng) {
long long x = (ok+ng)/2;
if (x*(x+1) <= n*2) ok = x;
else ng = x;
}
if (ok*(ok+1) == n*2) cout << "YES\n" << ok << endl;
else cout << "NO" << endl;
}