首页 > 其他分享 >7月4日 Satellites

7月4日 Satellites

时间:2023-08-23 21:23:09浏览次数:36  
标签:std r1 r2 double Satellites pi

Satellites

#include <iostream>
#include <cmath>
using namespace std;

int main() {
  const double pi = 3.14159265358979323846;
  const double earthR = 6440;
  double a = 0, s = 0;
  std::string str = "";
  while (std::cin >> s >> a >> str) {
		if(str == "min"){
			a = a / 60;
		}

    double r1, r2;
    double r = s + earthR;
		// 圆弧距离
    r1 = (pi * 2 * r) * (a / 360);

		// 直线距离
		r2 = 2 * r * sin((pi * a) / 360);
		if(a > 180)
			r1 = 2 * pi * r - r1;

    printf("%.6f %.6f\n", r1, r2);
  }
  return 0;
}

标签:std,r1,r2,double,Satellites,pi
From: https://www.cnblogs.com/tlocdx/p/17652808.html

相关文章