Click Here to see the problem detail.
Solution
Let,
ratio of length and width = a:b
Length, L=ax=AB=CD
width, W=bx=AC=BD
where x is the common factor of the ratio.
Now,
here, θ must be in radian.
We know,
arc= angle made by the arc(in radian) * radius
=> AGC=θ*r
=>S=θ*kx
according to question,
2S + 2l = 400
=>2θ.kx + 2ax = 400
=> x=400/(2θk+2a)
Now L=ax & W=bx
Source Code
#include<stdio.h> #include<math.h> #include<ctype.h> #include<string.h> #include<stdlib.h> int main() { double a, b, k, theta, l, w, common; int i, len, m, test; char str[1000], first[500], second[500]; test = 1; while (gets(str)) { for (i = 0; str[i] != ':'; i++) { first[i] = str[i]; } first[i] = '\0'; for (m = 0; m < strlen(str) - i; m++) { second[m] = str[m + i + 1]; } second[m] = '\0'; a = atoi(first); b = atoi(second); k = (sqrt(pow(a, 2) + pow(b, 2)) / 2); theta = 2 * atan(b / a); common = 200 / (theta * k + a); l = a * common; w = b * common; printf("Case %d: %.10lf %.10lf\n", test, l, w); test++; } return 0; }
Next Previous