Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double a;
- double b;
- double c;
- cin >> a >> b >> c;
- if(a==0)
- {
- if(b==0)
- {
- if(c==0)
- {
- cout << "NWR" << endl;
- }
- else
- {
- cout << "BR" << endl;
- }
- }
- else
- {
- double x = (- c) / b;
- cout << x << endl;
- }
- }
- else
- {
- if((pow(b,2))-(4*a*c) > 0)
- {
- double x = ((- b) - (sqrt(pow(b,2))-(4*a*c))) / 2*a;
- double y = ((- b) + (sqrt(pow(b,2))-(4*a*c))) / 2*a;
- cout << x << " " << y << endl;
- }
- else
- {
- if((pow(b,2))-(4*a*c) == 0)
- {
- double x = (- b) / 2*a;
- cout << x << endl;
- }
- else
- {
- cout << "BR" << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement