kfoozminus's blog

By kfoozminus, history, 7 years ago, In English

Most probably I'm gonna get lots of downvote for this. But I freaking miss the jumping ball in the "Running" Status Codeforces had! It was so mind-relaxing and fun to stare at that thing, while waiting for verdict! Anyone else? :D

[Image collected from internet]

Full text and comments »

  • Vote: I like it
  • +119
  • Vote: I do not like it

By kfoozminus, history, 8 years ago, In English

I've solved a few probability problems from here and there. Now I want to solve topcoder problems. Does anybody have any topcoder problem list on probabilty/expected value? I'll keep adding them in this post if I find any.

I solved mostly basic probability/dp + expected value problems. I want to solve hard problems too on this topic — if anybody have any exceptional/hard/must solve problem (any OJ), please mention :)

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

By kfoozminus, history, 9 years ago, In English

This problem's solution ends up at

nCr(A+B-i, i) * nCr(A+B-2i, A-i) * pow(x, A-i) * pow(y, B-i) * pow(z, i) ; for every 0 <= i <= min(A, B)

All inputs are between 1 and 10^17 inclusive, and result should be printed as (result % M); where M = 1e6 + 3

I've seen a solution like this

while(A || B)
{
        u = A % M;
        v = B % M;
        tmp = 0;
        for ( i = 0; i <= min(u, v); i++)
        {
                tmp = (tmp + nCr(u+v-i, i) * nCr(u+v-2i, u-i) * pow(x, u-i) * pow(y, v-i) * pow(z, i)) % M;
        }
        ans = (ans * tmp) % M;
        A /= M;
        B /= M;
}

Full Source Code: link

Can you please explain how did he derive this?

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it