fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a, b, c;
  6. cin >> a >> b >> c;
  7. if (c < 0) {
  8. cout << "NO SOLUTION" << endl;
  9. } else {
  10. int s = c * c;
  11. int num= s - b;
  12. if (a == 0) {
  13. if (b == c * c) {
  14. cout << "MANY SOLUTIONS" << endl;
  15. } else {
  16. cout << "NO SOLUTION" << endl;
  17. }
  18. } else {
  19. if (num % a == 0) {
  20. int x = num / a;
  21. cout << x << endl;
  22. } else {
  23. cout << "NO SOLUTION" << endl;
  24. }
  25. }
  26. }
  27.  
  28. return 0;
  29. }
  30.  
  31.  
Success #stdin #stdout 0.01s 5292KB
stdin
1 2 -3
stdout
NO SOLUTION