結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
|
提出日時 | 2020-02-23 10:27:28 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 394 ms |
コンパイル使用メモリ | 25,856 KB |
実行使用メモリ | 13,632 KB |
最終ジャッジ日時 | 2024-10-10 01:36:36 |
合計ジャッジ時間 | 4,761 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 OLE * 1 -- * 1 |
other | -- * 122 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | for(scanf("%d",&T);T--;){ | ^~~~~~~~~~~~~~ main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%lld%lld%lld",&a,&b,&c); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
// https://atcoder.jp/contests/tricky/tasks/tricky_2#include <stdio.h>#include <math.h>#include <quadmath.h>int main(){int T;long long a,b,c;__float128 d;for(scanf("%d",&T);T--;){scanf("%lld%lld%lld",&a,&b,&c);if(!a){if(!b)puts(c?"0":"-1");else printf("1\n%.12Lf\n",-c*1.0L/b);}else{if(a<0)a=-a,b=-b,c=-c;d=((__float128)b)*b-((__float128)4)*a*c;if(d<0)puts("0");else if(d==0)printf("1\n%.12Lf\n",-b/2.0L/a);else{printf("2\n%.12Lf\n%.12Lf\n",(-b-sqrtl(d))/2/a,(-b+sqrtl(d))/2/a);}}}return 0;}