結果
問題 | No.648 お や す み |
ユーザー |
|
提出日時 | 2018-03-06 21:17:49 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 301 bytes |
コンパイル時間 | 1,968 ms |
コンパイル使用メモリ | 158,980 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-21 19:53:26 |
合計ジャッジ時間 | 4,391 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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-9using namespace std;int main(){long double n;cin >> n;long double kai = (-1+sqrt(1+4*2*n))/2;long double check = double(static_cast<long long>(kai));if (abs(kai-check)<=eps){printf("YES\n%.0f\n",kai);}else{printf("NO\n");}return 0;}