From 5931dd47230174cde9c2c44fd52648206d0072fc Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Fri, 20 Sep 2024 09:07:06 -0300 Subject: [PATCH] Solve Elevator in c --- solutions/beecrowd/1124/1124.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 solutions/beecrowd/1124/1124.c diff --git a/solutions/beecrowd/1124/1124.c b/solutions/beecrowd/1124/1124.c new file mode 100644 index 00000000..1606cd15 --- /dev/null +++ b/solutions/beecrowd/1124/1124.c @@ -0,0 +1,30 @@ +#include +#include +#include + +int main() { + int32_t width, length, r1, r2, x_r1, x_r2, y_r1, y_r2, + distance_betweeen_circle_centers; + + while (scanf("%d %d %d %d", &width, &length, &r1, &r2) && width && length && r1 && r2) { + if (width < r1 * 2 || width < r2 * 2 || length < r1 * 2 || length < r2 * 2) { + puts("N"); + continue; + } + + x_r1 = r1; + y_r1 = r1; + x_r2 = width - r2; + y_r2 = length - r2; + distance_betweeen_circle_centers + = sqrt(pow((x_r2 - x_r1), 2) + pow((y_r2 - y_r1), 2)); + + if (distance_betweeen_circle_centers >= (r1 + r2)) { + puts("S"); + } else { + puts("N"); + } + } + + return 0; +}