fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. float a, b, c;
  8. vector <int> kuna;
  9.  
  10. int kot(float a, float b, float c)
  11. {
  12. float d;
  13. d = pow(b, 2) - 4 * a*c;
  14. if (d > 0) return 2;
  15. else if (d == 0) return 1;
  16. else return 0;
  17. }
  18. int main()
  19. {
  20. while (cin >> a >> b >> c)
  21. {
  22. kuna.push_back(kot(a, b, c));
  23. }
  24. for (int i = 0; i < kuna.size(); i++)
  25. {
  26. cout << kuna[i] << endl;
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 15240KB
stdin
0.3 0.3 0.4 
0.5 1 0.5 
-0.5 -0.5 0
stdout
0
1
2