結果
問題 |
No.955 ax^2+bx+c=0
|
ユーザー |
|
提出日時 | 2024-03-04 22:55:14 |
言語 | C90 (gcc 12.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,178 bytes |
コンパイル時間 | 1,357 ms |
コンパイル使用メモリ | 24,064 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-29 17:33:10 |
合計ジャッジ時間 | 8,130 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 81 RE * 41 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:25:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%lld%lld%lld",&a,&b,&c); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <quadmath.h> #include <dlfcn.h> #define LoadLibraryA(s) dlopen(s,2) #define GetProcAddress dlsym #define FreeLibrary dlclose typedef __float128 (*type_sqrtq)(__float128); typedef int (*type_quadmath_snprintf)(char *s, size_t size, const char *format, ...); type_sqrtq mysqrtq; type_quadmath_snprintf myquadmath_snprintf; char buf[99]; int main(){ //void *H=LoadLibraryA("/usr/local/lib/gcc/9/libquadmath.dylib"); void *H=LoadLibraryA("/usr/lib64/libquadmath.so"); mysqrtq=(type_sqrtq)GetProcAddress(H,"sqrtq"); myquadmath_snprintf=(type_quadmath_snprintf)GetProcAddress(H,"quadmath_snprintf"); 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; __float128 _a=a,_b=b,_c=c; d=_b*_b-4.0Q*_a*_c; if(d<0)puts("0"); else if(d==0)printf("1\n%.12Lf\n",-b/2.0L/a); else{ puts("2"); myquadmath_snprintf(buf,99,"%.12Qf",(-_b-mysqrtq(d))/2/_a); puts(buf); myquadmath_snprintf(buf,99,"%.12Qf",(-_b+mysqrtq(d))/2/_a); puts(buf); } } //} return 0; }