FZU2121_神庙逃亡

水题。直接解二次方程判断点的高度即可。

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define g 10
using namespace std;

double vx,vy,s,h,t1,t2,T;
int n,t;

int main()
{
    scanf("%d",&t);
    while (t--)
    {
        scanf("%lf%lf%lf%lf",&s,&h,&vx,&vy);
        if (vy*vy/(2*g)<h)
        {
            puts("poor Merida!");
            continue;
        }
        T=s/vx;
        t1=(vy-sqrt(vy*vy-2*g*h))/g,t2=(vy+sqrt(vy*vy-2*g*h))/g;
        if (T>=t1 && T<=t2) puts("good done!");
            else puts("poor Merida!");
    }
    return 0;
}
如有转载,请注明出处(http://www.cnblogs.com/lochan)
原文地址:https://www.cnblogs.com/lochan/p/3433926.html