Submission #15238

#TimeUsernameProblemLanguageResultExecution timeMemory
15238sujin맛있는 과자 (kriii3_A)C++98
33 / 33
0 ms1196 KiB
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> long long combination(int n, int r){ int p[40] = { 0 }; for (int i = r + 1; i <= n; i++){ int t = i; for (int j = 2; j <= t; j++){ while (t % j == 0){ t /= j; p[j]++; } } } for (int i = 1; i <= n - r; i++){ int t = i; for (int j = 2; j <= t; j++){ while (t % j == 0){ t /= j; p[j]--; } } } long long x = 1; for (int i = 2; i < 40; i++) while (p[i]--) x *= i; return x; } int main(){ int a, b, N; long long K; scanf("%d %d %d %lld", &a, &b, &N, &K); double A = double(a < b ? a : b); double B = double(a > b ? a : b); double C = hypot(A, B); long long p = 0; for (int i = 0; i < K; i++){ p += combination(N, i); if (p >= K){ double x = A * B / 2; for (int j = 0; j < N - i; j++) x *= B * B; for (int j = 0; j < i; j++) x *= A * A; for (int j = 0; j < N; j++) x /= C * C; printf("%.12lf", log(x)); break; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...