享受Code::Blocks编辑快感的几个关键[转]

CUMCM2009-C

scturtle posted @ 2009年9月13日 14:38 in Other , 1527 阅读

只做了一些

#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;
}
NBSE 7th Class Text 说:
2023年9月29日 17:29

Nagaland Board 7th Class Book 2024 for Science, Social Science, English, Hindi, Mathematics, EVS, Various Provide in School Wise Free Distribution in Government School, NBSE High School Various Class Complete Students Do not Waste Summers Holidays, Download Nagaland Board Class Book 2024 Regular Practice new Lessions for Students Best idea Students Method.Nagaland Board Class Textbook 2024 Download NBSE 7th Class Textbook 2024 Available Official Website, Our Portal Provide Nagaland Board High School Books 2024 Download, Hindi Medium, English Medium and Urdu Medium Textbooks.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter