Why WA? Source here... (+)
Послано
YoD 29 май 2005 17:31
#include <stdio.h>
#include <math.h>
#define r 6400.0
#define PI 3.141592653589
#define EPS 1e-8
void norm(double &s, double &d)
{
while (s > PI) s -= PI;
while (s < -PI) s += PI;
while (d > 2*PI) d -= 2*PI;
while (d < -2*PI) d += 2*PI;
}
int main(void)
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
double s0, d0, sq = 0.0;
scanf("%lf %lf %lf", &s0, &d0, &sq);
s0 = s0*PI/180;
d0 = d0*PI/180;
s0 += sq/r; norm(s0, d0);
d0 += sq/(r*cos(s0)); norm(s0, d0);
s0 -= sq/r; norm(s0, d0);
d0 -= sq/(r*cos(s0)); norm(s0, d0);
printf("%.3lf\n%.3lf\n", s0*180/PI, d0*180/PI);
return 0;
}