---
# System prepended metadata

title: Satellites(UVA10221)
tags: [CPE一顆星必考題]

---

# Satellites(UVA10221)
## [程式繳交區](https://hackmd.io/@Renektonn/r1ILDyp_ke/edit)
## 題目
[點我](https://onlinejudge.org/external/102/10221.pdf)
## 解題網站
[UVA](https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1162)
ZJ上沒有此題

## Hint
餘弦定理、弧長、弦長、C cos用法

## 程式碼

```cpp=
#include <bits/stdc++.h>

#define PI 3.14159265358979

using namespace std;

double calArc(double s , double a){
    return 2 * PI * s * a / 360;
}

double calChord(double s , double a){
    return sqrt(pow(s , 2) + pow(s , 2) - 2 * pow(s , 2) * cos(a * PI / 180));
}

int main()
{
    double s , a;
    string str;
    while(cin >> s >> a >> str){
        s += 6440;
        if(str.at(0) == 'm'){
            a /= 60;
        }
        if(a > 180){
            a = 360 - a;
        }
        
        printf("%.6f %.6f\n" , calArc(s , a) , calChord(s , a));
    }
    
    return 0;
}

```

