結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-01 22:32:59 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 31,232 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-22 17:15:41 |
| 合計ジャッジ時間 | 2,763 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 76 WA * 46 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
long a, b, c;
double s1, s2;
scanf("%ld%ld%ld", &a, &b, &c);
if (a == 0) {
if (b == 0) {
printf("-1\n");
return EXIT_SUCCESS;
}
s1 = (double)-c/b;
printf("1\n%.15lf\n", s1);
return EXIT_SUCCESS;
}
long long D = (long long)b*b - (long long)4*a*c;
if (D > 0) {
s1 = (double)-b/(2*a) - sqrt(D)/(2*a);
s2 = (double)-b/(2*a) + sqrt(D)/(2*a);
printf("2\n%.15lf\n%.15lf\n", s1, s2);
} else if (D == 0) {
s1 = (double)-b/(2*a);
printf("1\n%.15lf\n", s1);
} else {
printf("0\n");
}
return EXIT_SUCCESS;
}