Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


History
2017-05-27 11:35:08
2017-05-27 11:27:00
Task:Epic set
Sender:Game of Nolife
Submission time:2017-05-27 11:35:08
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ld a, b;
	cin >> a >> b;
	if (b == 4) {
		if (a == 3) {
			cout << 0 << "\n";
		} else {
			cout << "0.5\n";
		}
	} else if (b == 8) {
		if ((a <= 2)||(a ==4)) {
			cout <<  setprecision(15)  << (ld)1/(ld)3 << "\n";
		} else {
			cout << 0 << "\n";
		}
	} else {
		cout << setprecision(15) << (log(a + 1) - log(a))/log(b) << "\n";
	}
}