Блог пользователя R.A.X

Автор R.A.X, 10 лет назад, По-английски

I am unable to solve this problem http://codeforces.me/contest/441/problem/E .Can you guys provide me with some hints?

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
  • »
    »
    10 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    I tried reading the editorial but I am not getting it (may be it is too advance !). But I found that some people solved the problem in few lines can you explain the dp states
    p: is the probability of getting number smaller than p ~~~~~

    for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j)
    if (!i)
    for (int a = x + j; !(a & 1); ++f[i][j], a >>= 1);
    else
    {
    f[i][j] += f[i — 1][j + 1] * (1.0 — p);
    if (!(j & 1))
    f[i][j] += (f[i — 1][j / 2] + 1) * p;
    }

    ~~~~~