結果
問題 | No.648 お や す み |
ユーザー |
|
提出日時 | 2024-10-12 10:09:03 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 2,871 ms |
コンパイル使用メモリ | 244,416 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 10:09:13 |
合計ジャッジ時間 | 4,940 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define endl "\n"typedef long long ll;#define int long longint n;void solved() {cin >> n;int l = 1, r = 2e9;while (l < r) {int x = (l + r) >> 1;if ((1 + x) * x / 2 >= n)r = x;elsel = x + 1;}if ((1 + l) * l / 2 != n)cout << "NO" << endl;else {cout << "YES" << endl;cout << l << endl;}}signed main() {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);/*int t = 1;cin >> t;while (t--)*/solved();return 0;}