結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
![]() |
提出日時 | 2019-12-18 00:29:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,113 bytes |
コンパイル時間 | 1,297 ms |
コンパイル使用メモリ | 167,372 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 23:56:20 |
合計ジャッジ時間 | 3,573 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 53 WA * 69 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff; template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; } template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; } //template end int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a==0){ if(b==0){ printf(c?"0\n":"-1\n"); return 0; } else{ printf("1\n"); double x=-c/b; printf("%.12f\n",x); return 0; } } if(b*b-4*a*c==0){ printf("1\n"); double x=-b/2/a; printf("%.12f\n",x); return 0; } if(b*b-4*a*c<0)printf("0\n"); else{ printf("2\n"); double x=-b+sqrt(b*b-4*a*c); x/=2*a; printf("%.12f\n",x); x=-b-sqrt(b*b-4*a*c); x/=2*a; printf("%.12f\n",x); return 0; } return 0; }