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:超过1000000000时就很溢出unsigned long long了,怎么办?

Posted by superDD at 2009-10-06 22:39:25 on Problem 3696
In Reply To:超过1000000000时就很溢出unsigned long long了,怎么办? Posted by:4h at 2008-10-07 21:11:12
这题溢出不是很严重~~猥琐的一招~~
a*b%m=Mod(a,b,m);
long long Mod(long long a,long long b,long long m)
{
	long long ans1,ans2;
	ans1=a*(b%100000)%m;
	ans2=a*(b/100000)%m*100000%m;
	return (ans1+ans2)%m;
}

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