이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
void f(double a,double b,double c,ll N,ll K){
if(N<0){
cout<<a+b-log(2);
return;
}
if(a>b)swap(a,b);
if(K>(1ll<<N)){
f(a+b-c,2*b-c,b,N-1,K-(1ll<<N));
}
else{
f(2*a-c,a+b-c,a,N-1,K);
}
}
int main(){
ios::sync_with_stdio(0);
cout<<fixed;
cout.precision(10);
ll N,K;
double a,b,c;
cin>>a>>b>>N>>K;
K=(1ll<<N)-K+1;
c=sqrt(a*a+b*b);
f(log(a),log(b),log(c),N-1,K);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |