Submission #15478

#TimeUsernameProblemLanguageResultExecution timeMemory
15478pichulia맛있는 과자 (kriii3_A)C++98
33 / 33
0 ms1212 KiB
#include<stdio.h> #include<algorithm> #include<math.h> using namespace std; long long int a,b,n,k; long long int c[50][50]; int main() { scanf("%lld %lld %lld %lld",&a,&b,&n,&k); if(a<b) { long long int tt = a; a = b; b = tt; } int i, j; c[0][0]=1; for(i=1;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]; } } i=0; while(1) { if(k <= c[n][i])break; k -= c[n][i]; i++; } double aa = log(a)*2; double bb = log(b)*2; double cc = log(a*a+b*b)*n; printf("%.10lf\n",aa*(n-i) + bb*i - cc + log(a*b/2.0)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...