結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
|
提出日時 | 2020-02-23 10:28:00 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 562 bytes |
コンパイル時間 | 477 ms |
コンパイル使用メモリ | 25,088 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 01:36:55 |
合計ジャッジ時間 | 3,882 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 98 WA * 24 |
コンパイルメッセージ
main.c: In function ‘main’: 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; }