結果
| 問題 |
No.648 お や す み
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-06 21:19:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 293 bytes |
| コンパイル時間 | 1,294 ms |
| コンパイル使用メモリ | 160,436 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-21 19:56:34 |
| 合計ジャッジ時間 | 3,412 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 53 WA * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:33: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat=]
11 | printf("YES\n%.0f\n",kai);
| ~~~^ ~~~
| | |
| | long double
| double
| %.0Lf
ソースコード
#include <bits/stdc++.h>
#define eps 1e-9
using namespace std;
int main(){
long double n;
cin >> n;
long double kai = (-1+sqrt(1+4*2*n))/2;
long double check = static_cast<long long>(kai);
if (abs(kai-check)<=eps){
printf("YES\n%.0f\n",kai);
}
else{
printf("NO\n");
}
return 0;
}