#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
void f(long double a,long double b,long double c,ll N,ll K){
if(N<0){
cout<<a+b-log(2);
return;
}
if(K>(1ll<<N)){
f(a+b-c,2.0*b-c,b,N-1,K-(1ll<<N));
}
else{
f(2.0*a-c,a+b-c,a,N-1,K);
}
}
int main(){
ios::sync_with_stdio(0);
cout<<fixed;
cout.precision(15);
ll N,K;
long double a,b,c;
cin>>a>>b>>N>>K;
if(a>b)swap(a,b);
K=(1ll<<N)-K+1;
c=sqrt(a*a+b*b);
f(log(a),log(b),log(c),N-1,K);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1736 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1736 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |