fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a, b, c, d;
  6. float x, y;
  7. cin >> a >> b >> c >> d;
  8. x = ((float)d/((float)d-(float)c))*(float)b - (float)a/((float)d-(float)c);
  9. y = (-1*(float)c/((float)d-(float)c))*(float)b + (float)a/((float)d-(float)c);
  10. if(x<0||y<0){
  11. cout << "miss" << endl;
  12. }
  13. else{
  14. cout << x << " " << y << endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 15240KB
stdin
2 2 1 1
stdout
-nan -nan