fork download
  1. #include <cmath>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6. int H, W, h, w;
  7. cin >> h >> w >> H >> W;
  8. int t = max(H, W);
  9. H = min(H, W);
  10. W = t;
  11. t = max(h, w);
  12. h = min(h, w);
  13. w = t;
  14. int d2 = w * w + h * h;
  15. (h <= H and w <= W or H * sqrt(d2 - W*W) + W * sqrt(d2 - H*H) <= w * w - h * h) and (cout << "Possible") or (cout << "Impossible");
  16. return 0;
  17. }
Success #stdin #stdout 0s 15232KB
stdin
20 40
2 4
stdout
Possible