Matuiss2

elevator-c++-right one

Nov 7th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define debug(x) cout << #x " = " << (x) << endl
  3. #define endl '\n'
  4.  
  5. using namespace std;
  6.  
  7. bool f(double w, double h, double r1, double r2) {
  8.   double dx = w - r1 - r2, dy = h - r1 - r2;
  9.   if (dx < 0 || dy < 0) return false;
  10.   return dx * dx + dy * dy >= (r1 + r2) * (r1 + r2) && min(h, w) >= 2 * max(r1, r2);
  11. }
  12.  
  13. int main() {
  14.   ios_base::sync_with_stdio(false);cin.tie(NULL);
  15.   double w, h, r1, r2;
  16.   while (cin >> w >> h >> r1 >> r2 && (w + h + r1 + r2) > 0) {
  17.     puts(f(w, h, r1, r2) ? "S" : "N");
  18.   }
  19.   return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment