| ||||||||||
| 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 | |||||||||
try this function~In Reply To:关于这道题,请教大侠一个问题? Posted by:HCman at 2008-10-27 20:02:36 typedef unsigned long long llong;
llong pro(llong x,llong y,llong n)
{
llong ret=0,tmp=x%n;
for(;y;y>>=1)
{
if(y&0x1)
if((ret+=tmp)>n)ret-=n;
if((tmp<<=1)>n)tmp-=n;
}
return ret;
}
用这个来做乘法运算~计算(x*y)%n
PS.枚举直接dfs就好了,就是把它的素因子拿去乘~
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator