Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

inverse modulo

$
0
0

can someone explain why this code works and theory behind it

inv[0]=inv[1]=1;
    for(i=2;i<=max;i++)
            inv[i] = mod - (((long long)mod/i)*inv[mod%i])%mod;

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>