algorithm - Criteria for choosing mod value -
i have array array = {}, size of array n
my constraints this:
n <= 100000 , arrayi <=100
i have find products of elements in array, given mod value have mod product. mod value changes time , mod value less or equal n.
my problem when chose, global mod value r = 1000000000 (which far bigger mod constraint) , whenever product exceeds value, mod result.
but dont know why result im obtaining zero.
my question how chose r in such situations?
i dont know code likey 0 correct result.
pick r large prime , make sure none of elements divisible number in order result different 0.
Comments
Post a Comment