Indiot's blog

By Indiot, history, 4 months ago, In English

Hi!

Could someone plz explain to me why 1 / 2 modulo 1e9 + 7 = 5e8 + 5? ![ ](tmp)

my modulo function

output 5e8 + 4.

Thanks!

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

»
4 months ago, # |
  Vote: I like it +29 Vote: I do not like it

$$$\dfrac{1}{2} \equiv 500000004 \pmod {10^9+7}$$$, but I think the sample output is $$$\dfrac{3}{2}$$$ cause $$$1 + \dfrac{1}{2} = \dfrac{3}{2}$$$...

»
4 months ago, # |
  Vote: I like it -35 Vote: I do not like it

There's something wrong in the statement. Perhaps it is mod 1e9+9 actually.