Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <assert.h>
- #include <stdio.h>
- #include <math.h>
- const double EPS = 1e-9;
- int main() {
- double best_len, pa_len;
- while (scanf("%lf%lf", &best_len, &pa_len) == 2) {
- assert(pa_len >= best_len - EPS);
- double k = (pa_len - best_len) / best_len;
- if (k > 1) k = 1;
- double res = cos(k * M_PI / 2);
- if (res < 0) res = 0;
- printf("%.9lf\n", res);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement