C - 浮気調査 / AtCoderBeginnerContet#010

abc010.contest.atcoder.jp

#include <cmath>
#include <iostream>
using namespace std;

void Solve(int txa, int tya, int txb, int tyb, int T, int V)	{
	int n, x, y;
	bool flg=false;

	cin >> n;
	for (int i=0; i<n; ++i)	{
		cin >> x >> y;
		if (sqrt( pow( (double)x-txa,2.0 )+pow( (double)y-tya,2.0) )+sqrt( pow( (double)txb-x,2.0)+pow( (double)tyb-y,2.0) ) <= T*V)	flg=true;
	}
	cout << (flg? "YES" : "NO") << endl;
}

int main(void)	{
	int txa, tya, txb, tyb, T, V;

	cin >> txa >> tya >> txb >> tyb >> T >> V;
	Solve(txa,tya,txb,tyb,T,V);
	return 0;
}

移動距離を出して行くことが出来る範囲内ならYES、無理な範囲ならNOを出力する。