#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
ll d[50][50];
void init(int N){
d[0][0]=1;
for(int i=1;i<=N;i++)
for(int j=0;j<=i;j++)
if(j==0)d[i][j]=1;
else d[i][j]=d[i-1][j]+d[i-1][j-1];
}
void f(int A,int B,double a,double b,double c){
double t;
for(int i=0;i<A;i++){
t=a+a-c;
b=a+b-c;
c=a;
a=t;
}
for(int i=0;i<B;i++){
t=b+b-c;
a=a+b-c;
c=b;
b=t;
}
cout<<a+b-log(2);
}
int main(){
ios::sync_with_stdio(0);
cout<<fixed;
cout.precision(13);
ll a,b,N,K;
cin>>a>>b>>N>>K;
init(N);
for(int i=0;i<=N;i++){
if(K<=d[N][i]){
f(i,N-i,log(a),log(b),log(sqrt(a*a+b*b)));
break;
}
K-=d[N][i];
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1840 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1840 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |