Posted in 2017 PacNW, ACM-ICPC

2017 PacNW E Straight Shot

/* 11/16/2017
* Solution: Use binary search to find the appropriate angle.
*/

#include
#include
#include
#define PI acos(-1)
using namespace std;

int main() {
	long long n, x;
	double vv;
	int ll, rr;
	double v;
	double summ = 0;
	cin >> n >> x >> v;
	for (int i = 1; i > ll >> rr >> vv;
		summ += (rr - ll) * 1.0 * vv / v;
	}
	if (summ > 0) {
		summ = - summ;
	}
	double l = 0, r = 90;
	double result = 100; 
	while (abs(result) > 1e-5) {
		if (l > 60) {
			cout  60) {
		cout << "Too hard";
	} else {
		cout << fixed << setprecision(3) << (double)x / (v * cos(l * PI / 180));
	}
	return 0;
} 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s