Submission #15195

#TimeUsernameProblemLanguageResultExecution timeMemory
15195gs14004맛있는 과자 (kriii3_A)C++14
33 / 33
0 ms1844 KiB
#include <cstdio> #include <cmath> #include <algorithm> #include <iostream> #include <iomanip> using namespace std; typedef long long lint; lint bino[44][44]; int main(){ for(int i=0; i<44; i++){ bino[i][0] = 1; for(int j=1; j<=i; j++){ bino[i][j] = bino[i-1][j] + bino[i-1][j-1]; } } int a, b, n; long long k; scanf("%d %d %d %lld",&a,&b,&n,&k); long double addi0 = log(1.0 * (a * a) / (a * a + b * b)); long double addi1 = log(1.0 * (b * b) / (a * a + b * b)); int p = 0; for(int i=0; i<=n; i++){ if(bino[n][i] >= k){ p = i; break; } k -= bino[n][i]; } if(addi0 > addi1) swap(addi0, addi1); cout << setprecision(30) << p * addi0 + (n - p ) * addi1 + log(a * b * 0.5); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...