/****************************************************************************************************
尼玛~忘了考虑火枪还会往后面跑,vd * vd < vb * vb,人是跑不过子弹的。。。二分狼人被毙掉的时间,然后看火枪
跑路的时间加上子弹跑路的时间是否小于狼人被毙掉的时间。另外,这输出小数点后三位,为啥精度能卡成这样。。。神数据。。。
****************************************************************************************************/
#include <iostream>
#include <functional>
#include <algorithm>
//#include <hash_map> //Visual C++ lib
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <sstream>
#include <utility>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <limits>
#include <memory>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;
#define LOWBIT(x) ( (x) & ( (x) ^ ( (x) - 1 ) ) )
#define CLR(x, k) memset((x), (k), sizeof(x))
#define CPY(t, s) memcpy((t), (s), sizeof(s))
#define LEN(s) static_cast<int>( strlen((s)) )
//typedef long long LL; //GNU C++
//typedef unsigned long long ULL;
typedef __int64 LL; //Visual C++ 2010
typedef unsigned __int64 ULL;
typedef double LF;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
//typedef hash_map<int, int>::iterator HMI;
typedef map<int, int>::iterator MI;
typedef vector<int>::iterator VI;
typedef list<int>::iterator LI;
typedef set<int>::iterator SI;
const int INF_INT = 0x3f3f3f3f;
const LL INF_LL = 0x7fffffffffffffffLL; //15f
const double oo = 10e9;
const double eps = 10e-9;
const double PI = acos(-1.0);
struct Point
{
LF x, y;
}lyc, snp;
struct Vct
{
LF vx, vy;
}vct;
LF vd, vb, L;
inline bool zero(const LF &x)
{
return fabs(x) < eps;
}
inline LF dist(const Point &pa, const Point &pb)
{
return sqrt(pow(pa.x - pb.x, 2.0) + pow(pa.y - pb.y, 2.0));
}
bool can(LF lt)
{
Point kill;
kill.x = lyc.x + vct.vx * lt;
kill.y = lyc.y + vct.vy * lt;
LF dsk = dist(snp, kill);
LF rt, bt;
rt = fabs(dsk - L) / vd;
bt = L / vb;
if (rt + bt < lt - eps)
{
return true;
}
return false;
}
LF bisearch()
{
LF low = L / vb, high = 10e9, mid = (low + high) * 0.5;
while (high - low > eps)
{
mid = (low + high) * 0.5;
if (can(mid))
{
high = mid;
}
else
{
low = mid;
}
}
return mid;
}
void ace()
{
LF ans;
while (cin >> lyc.x >> lyc.y >> snp.x >> snp.y >> vct.vx >> vct.vy >> vd >> vb >> L)
{
if (zero(lyc.x) && zero(lyc.y) && zero(snp.x) && zero(snp.y) &&
zero(vct.vx) && zero(vct.vy) && zero(vd) && zero(vb) && zero(L))
{
break ;
}
ans = bisearch();
printf("%.3lf %.3lf\n", L, ans);
}
return ;
}
int main()
{
ace();
return 0;
}
HDU 4024数学题
最新推荐文章于 2019-04-21 15:36:41 发布