Submission #15408

#TimeUsernameProblemLanguageResultExecution timeMemory
15408jeapi맛있는 과자 (kriii3_A)C++98
0 / 33
0 ms1828 KiB
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	int a, b, N;
	long long T,K;
	cin >> a >> b >> N >> K;

	if (a > b){
		int t = a;
		a = b;
		b = t;
	}
	double S = log(a*b/2);
	a = a*a;
	b = b*b;
	double A = log((double)a / (double)(a + b));
	double B = log((double)b / (double)(a + b));
	T = 1;
	for (int i = 0; i < N; i++){
		T *= 2;
	}
	while (T > 1){
		T = T / 2;
		if (K<=T){
			S += B;
		}
		else{
			K = K - T;
			S += A;
		}
	}
	printf("%.10f\n", S);

	return 0;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...