結果

問題 No.648  お や す み 
ユーザー tonyu0
提出日時 2020-04-05 01:52:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 95,768 KB
最終ジャッジ日時 2025-01-09 14:11:54
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr long double EPS = 1e-10;

long double n;

int main() {
  cin >> n;
  long double m = (sqrt(n * 8.0 + 1.0) - 1.0) / 2.0;
  if (m - floor(m) < EPS) {
    cout << fixed << setprecision(0);
    cout << "YES" << endl << m;
  } else {
    cout << "NO";
  }
  cout << endl;
  return 0;
}
0