Submission #15177

#TimeUsernameProblemLanguageResultExecution timeMemory
15177ainta맛있는 과자 (kriii3_A)C++98
33 / 33
0 ms1204 KiB
#include<stdio.h> #include<algorithm> #include<math.h> using namespace std; long long K, C[41][41], S; int a, b, n; double Res; int main() { int i, j, x; scanf("%d%d%d%lld",&a,&b,&n,&K); if(a<b)swap(a,b); for(i=0;i<=n;i++){ C[i][0]=1; for(j=1;j<=i;j++)C[i][j]=C[i-1][j-1]+C[i-1][j]; } for(i=0;i<=n;i++){ S+=C[n][i]; if(S>=K)break; } x = i; Res=a*b*0.5; Res = log(Res); for(i=1;i<=x;i++){ Res=Res+log(b*b)-log(a*a+b*b); } for(i=1;i<=n-x;i++){ Res=Res+log(a*a)-log(a*a+b*b); } printf("%.11lf\n",Res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...