Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
计算((p^(eB+1)-1)/(p-1))%MOD1.可以首先计算rem=p^(eB+1)%(MOD*(p-1)) 2.然后计算rem=(rem-1+MOD*(p-1))/(p-1) 3.最后计算rem%MOD 这样不需要二分。但是MOD*(p-1)可能会超过32位,所以在计算p^(eB+1)%(MOD*(p-1))时候可能乘法会溢出....careful.... Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator