//总结:想到应该马上敲,,不要在那里犹豫,,推什么狗屁公式、。、先敲再说。。
//推一个敲一个。。不然时间会被耗光。。就是这样。。

//就考个物理公式,,然后要一步一步来,,理清题目的要求的。。题目给出3种鸟的飞行方式,,然后求飞行距离。。
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;

const double G=9.8;

int main()
{
    double H;
    while(cin>>H)
    {
        char ch[10];
        scanf("%s",ch);
        if(ch[0]=='R')
        {
            double vx,vy;
            cin>>vx>>vy;
            double t=(vy+sqrt((vy)*(vy)+2*G*(H)))/(G);
            printf("%.3lf\n",vx*t);
        }
        else if(ch[0]=='B')
        {
            double vx,vy,t,T,s0,s1,s2,s3,v1,v2,v3;
            cin>>vx>>vy>>t>>v1>>v2>>v3;
            s1=s2=s3=vx*t;
            T=(vy+sqrt((vy)*(vy)+2*G*(H)))/(G);
            if(T<t)
            {
                printf("%.3lf\n",vx*T);
                continue;
            }
            s1+=v1*(T-t);
            s2+=v2*(T-t);
            s3+=v3*(T-t);
            printf("%.3lf %.3lf %.3lf\n",s1,s2,s3);

        }
        else if(ch[0]=='Y')
        {
            double vx,vy,t,t1,s1,s2,T;
            cin>>vx>>vy>>t;
            T=(vy+sqrt((vy)*(vy)+2*G*(H)))/(G);
            if(T<t)
            {
                printf("%.3lf\n",vx*T);
                continue;
            }
            s1=vy*t-0.5*G*t*t;
            s2=vx*t;
            vy=vy-G*t;
            vx*=2.0;
            vy*=2.0;
            t1=(vy+sqrt((vy)*(vy)+2*G*(s1+H)))/(G);
            s2+=vx*t1;
            printf("%.3lf\n",s2);
        }
    }
    return 0;
}

posted on 2012-02-04 20:28  →木头←  阅读(272)  评论(0编辑  收藏  举报