Submission #15412

#TimeUsernameProblemLanguageResultExecution timeMemory
15412tlwpdus맛있는 과자 (kriii3_A)C++98
33 / 33
0 ms1212 KiB
#include<stdio.h> #include<math.h> using namespace std; long long pas[50][50]; int a, b, n; long long k; void input() { scanf("%d %d %d %lld", &a, &b, &n, &k); if (a > b) { int t = a; a = b; b = t; } } void init() { int i, j; for (i = 0; i <= n + 1; i++) { for (j = 0; j <= i; j++) { if (j == 0 || j == i) pas[i][j] = 1; else pas[i][j] = pas[i - 1][j] + pas[i - 1][j - 1]; } } } void process() { int i; long long sum = 0; for (i = 0; i <= n; i++) { sum += pas[n][i]; if (sum >= k) { break; } } double alog = log((double)(a*a) / (a*a + b*b)), blog = log((double)(b*b) / (a*a + b*b)); double S = log((double)(a*b) / 2); printf("%.12lf\n", S + i*alog + (n - i)*blog); } int main() { input(); init(); process(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...