Posted in 2017 PacNW, ACM-ICPC

2017 PacNW L Delayed work

/* 11/14/2017
*/

#include
#include
#include
using namespace std;

int main() {
long long k, p, x;
cin >> k >> p >> x;
int m = ceil(sqrt(k * p / x));
double ans = (double)k * p / m + x * m ;
cout << fixed << setprecision(3) << ans;
return 0;
}

Posted in 2017 PacNW, ACM-ICPC

2017 PacNW C Fear factoring

/* 11/12/2017
*/


#include
#include 
using namespace std;

int main() {
	long long a,b;
	cin >> a >> b;
	long long tmp = sqrt(b);
	long long ans = 0;
	for (long long i = 1; i <= tmp; i++) {
		long long lb = max(tmp, (a-1) / i) + 1;
		long long ub = max(tmp, b / i);
		ans += i * (b / i - (a-1)/ i) + (lb + ub) * (ub - lb + 1) / 2;
	}
	cout << ans;
	return 0;
}
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;
} 
Posted in 2017 PacNW, ACM-ICPC

2017 PacNW A Odd Palindrome

/* 11/14/2017
* /


#include
#include
using namespace std;

int main() {
	string s;
	cin >> s;
	int len = s.length() - 1;
	for (int i = 0; i < len; i++) {
		if (s[i] == s[i + 1]) {
			cout << "Or not." << endl;
			return 0;
		}
	}
	cout << "Odd." << endl;
	return 0;
}