Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:some test data: 希望有点用

Posted by Stareven at 2010-11-16 18:05:14 on Problem 3696
In Reply To:some test data: 希望有点用 Posted by:scaneeling at 2008-11-13 18:32:07
好吧。。真的很有用。。。
因为m=9*L/GCD(8,9*L)会爆int,所以m*m会爆long long。二分求幂时应该处理好。
我的做法是拆分a,b;比如求a*b%m时,
a=ax*10e6+ay
b=bx*10e6+by
ans=( (ax*bx*(10e12%m))%m + (ax*by+ay*bx)*10e6%m + (ay*by)%m ) %m
取10e6是因为,m最大接近是10e10量级的,所以这里10e6*10e6后,可以把高位的缩小。
说不清了。。理解万岁。。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator