CUMCM2009-C

2009年9月13日 14:38

只做了一些

#include <iostream>
#include "math.h"
using namespace std;

double r=6378.140;//地球半径 km
double pai=3.14159;//π

double func1(int stations)//计算最小高度
{
    double angle1=(stations-2)*180/(stations*2);//角度1
    //cout<<"angle1="<<angle1<<endl;
    double angle2=(180-angle1*2)/2+3;//角度2
    //cout<<"angle2="<<angle2<<endl;
    return (r*cos(angle1/180*pai)*tan(angle2/180*pai))+r*sin(angle1/180*pai);
}

double func2(double h,double erfa)
{
    double l1=h*sin(erfa/180*pai);
    cout<<"l1:"<<l1<<endl;
    double l2=sqrt(h*h-(r*sin(87.0/180*pai))*(r*sin(87.0/180*pai)))-r*cos(87.0/180*pai);
    l2=l2*sin(87.0/180*pai)*2;
    cout<<"l2:"<<l2<<endl;
    double l3=sqrt(l2*l2-l1*l1*4);
    cout<<"l3:"<<l3<<endl;
    double beita=asin((l3/2)/(h*cos(erfa/180*pai)));
    cout<<"berita:"<<beita<<endl;
    return pai/beita;
}

int main()
{
    /** problem 1 **/
    cout<<"r:"<<r<<"  "<<"pai:"<<pai<<endl;
    cout <<"题目1中需检测的卫星的运行高度(距地表 km):";
    double h;
    cin>>h;
    h+=r;
    cout<<"其距地心:"<<h<<endl;
    for(int i=3;;)
    {
        cout<<"i:"<<i<<"    "<<func1(i)<<endl;
        if(func1(i)<=h)
        {
            cout<<"需要检测站个数:"<<i<<endl;
            break;
        }
        else i++;
    }
    /** problem2 **/
    double h2,erfa;
    cout<<"卫星离地面高度(km):";
    cin>>h2;
    h2+=r;
    cout<<"轨道与赤道夹角(如60):";
    cin>>erfa;
    cout<<"需要检测站个数:"<<func2(h2,erfa)<<endl;
    return 0;
}

评论(1) 阅读(1529)

Happy here

2009年8月30日 05:35

不错的一个博客站点哟~

可惜我不太爱说话。

尤其是写字。

评论(1) 阅读(1654)