結果
問題 |
No.1179 Quadratic Equation
|
ユーザー |
![]() |
提出日時 | 2021-01-03 16:51:46 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-10-13 10:21:35 |
合計ジャッジ時間 | 1,148 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
# my $t = <>; my $t = 1; if($t == 0) { exit; } while ($t--) { my ($a, $b, $c) = split(/ /, <>); if($a == 0) { if($b == 0){ if($c == 0){ print "3\n"; } else { print "0\n"; } } else { printf "%.12f\n", -$c/$b; } } else { my $d = $b * $b - 4 * $a * $c; if($d > 0){ # print "2 "; my $s = sqrt($d); if($a > 0){ printf "%.12f ", (-$b-$s)/(2*$a); printf "%.12f \n", (-$b+$s)/(2*$a); } else { printf "%.12f ", (-$b+$s)/(2*$a); printf "%.12f\n", (-$b-$s)/(2*$a); } } elsif($d == 0){ # print "1 "; printf "%.12f\n", -$b/(2*$a); } else { print "imaginary\n" } } }