結果

問題 No.648  お や す み 
ユーザー Kutimoti_T
提出日時 2018-05-27 10:02:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 1,343 ms
コンパイル使用メモリ 158,964 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 18:24:29
合計ジャッジ時間 3,206 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 79 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

long double n;

int main(){
  cin >> n;
  i64 r = sqrt(1 + 8 * n);
  if(1 + 8 * n == r * r){
    cout << "YES" << endl;
    cout << (1 + r) / 2 - 1 << endl;
  }
  else{
    cout << "NO" << endl;
  }
}
0