// UVa 10221 - Satellites #include <iostream> #include <string> #include <stdio.h> #include <math.h> using namespace std; int main() { double s, a; string unit; while (cin >> s >> a >> unit) { double radius = s + 6440; double degrees = (unit == "deg") ? a : a / 60; if (degrees > 180) degrees = 360 - degrees; double alpha = degrees / 180 * M_PI; double arc = alpha * radius; double chord = 2 * radius * sin(alpha / 2); printf("%.6f %.6f\n", arc, chord); } return 0; }
Showing posts with label UVa 10221 - Satellites. Show all posts
Showing posts with label UVa 10221 - Satellites. Show all posts
Wednesday, May 13, 2015
UVa 10221 - Satellites
Subscribe to:
Posts (Atom)