結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
|
提出日時 | 2019-12-18 03:08:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 525 ms |
コンパイル使用メモリ | 31,232 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 00:20:40 |
合計ジャッジ時間 | 2,903 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 69 WA * 53 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%lld%lld%lld", &a, &b, &c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> int main() { long long int a, b, c; scanf("%lld%lld%lld", &a, &b, &c); if (a == 0) { if (b == 0) { if (c == 0) printf("-1\n"); else printf("0\n"); } else printf("1\n%.20lf\n", (double)c / b); } else { if (b * b - 4 * a * c > 0) printf("2\n%.20lf\n%.20lf\n", (double) (-b - sqrt(b * b - 4 * a * c))/ (a << 1), (double) (-b + sqrt(b * b - 4 * a * c))/ (a << 1)); else if (b * b - 4 * a * c < 0) printf("0\n"); else printf("1\n%.20lf\n", (double) -b / (a << 1)); } }