fork download
  1. #include <bits/stdc++.h>
  2. typedef long long ll;
  3. using namespace std;
  4. ll k, l, m, n;
  5. int main() {
  6. int t;
  7. scanf("%d", &t);
  8. while(t--) {
  9. scanf("%lld%lld%lld%lld", &k, &l, &m, &n);
  10. ll a = k, b = l;
  11. ll s1 = m, s2 = n;
  12. double f = sqrt(s2) / sqrt(s1);
  13. cout << fixed << setprecision(10) << a*f-b << " " << b*f-a << endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 4404KB
stdin
1
18 16 72 288
stdout
20.0000000000 14.0000000000