Shatakjain2901's blog

By Shatakjain2901, 6 years ago, In English

can anyone tell me how does the probability in last cast when both are 0 becomes m-1/(2*m)?? i have seen a code having this

if(!a[i] && !b[i]) { v.push_back(make_pair((((m-1)%M)*num)%M, (den*((2*m)%M))%M) ); den = (den*(m%M))%M; } somebody plz me how is the probability calculated in this case?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it