Submission #15818

#TimeUsernameProblemLanguageResultExecution timeMemory
15818didw맛있는 과자 (kriii3_A)C++98
Compilation error
0 ms0 KiB
#include <iostream> #include <cstdio> #include <cmath> using namespace std; double rs, rb; long long cache[41][41]; long long coef(int n, int r) { if (r == 0 || n == r) return 1; long long& ret = cache[n][r]; if (ret != -1) return ret; ret = coef(n-1, r-1) + coef(n, r-1); return ret; } int main() { long long a, b, n, k; cin >> a >> b >> n >> k; if (a > b) swap(a, b); rs = log((double)a*a / (double)(a*a + b*b)); rb = log((double)b*b / (double)(a*a + b*b)); double S0 = log(a*b / 2.0); int idx = 0; memset(cache, -1, sizeof(cache)); while (k > coef(n, idx)) { k -= coef(n, idx); idx++; } for (int i = 0; i < idx; ++i) S0 += rs; for (int i = idx; i < n; ++i) S0 += rb; printf("%.12f\n", S0); }

Compilation message (stderr)

A.cpp: In function ‘int main()’:
A.cpp:26:36: error: ‘memset’ was not declared in this scope
     memset(cache, -1, sizeof(cache));
                                    ^