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

注意了!!必须用__int64,用long int WA;而且要注意ax+by=c中a、c的正负;以及结果应属于(1,L/gcd(a,L))

Posted by JokerKS at 2010-09-11 13:56:01 on Problem 1061
RT
a是两蛙速度差,b是数轴长,求x
x=用辗转相除扩展算出ax+by=gcd(a,b)的解再乘以c/gcd(a,b)的值

以这题的数据来看
直接让a=n-m;c=x-y;就可以过了
让a=m-n;c=y-x;而之后不作处理就WA


假如得到结果是x
应该输出(x%t+t)%t  --(t=L/gcd(a,L))
即是使x>1且小于L/gcd(a,L)

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