Advertisement
rengetsu

ProcedurProgramavimas_2.18

Apr 5th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n;
  7.     cin>>n;
  8.     for(int kek=0;kek<n;kek++){
  9.     double a,b,c;
  10.     cin>>a>>b>>c;
  11.     cout<<fixed<<showpoint;
  12.     cout.precision(6);
  13.     if(a)
  14.     {
  15.         double d=b*b-4*a*c;
  16.         double ba=-b/(2.0*a);
  17.         if(d>0)
  18.         {
  19.             double sd=sqrt(d)/(2.0*a);
  20.             if (a>0)
  21.                 cout<<"2";
  22.             else
  23.                 cout<<"2";
  24.         }else if(d==0)
  25.             cout<<"1";
  26.         else
  27.             cout<<"0";
  28.     }else if(b)
  29.         cout<<"1";
  30.     else if(c)
  31.         cout<<"0";
  32.     else
  33.         cout<<"-1";
  34.         cout<<endl;
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement