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:多谢,改了就AC

Posted by haihongblog at 2015-12-20 21:49:38 on Problem 2891
In Reply To:避免中间过程超long long的方法 Posted by:chinabest at 2014-01-14 19:56:30
> 关键就在于求出方程的解有可能很大很大,要马上模掉。
> code:
>                 z=(r2-r1)/rnt*z;
>                 I64 tmp=m2/rnt;
>                 z=((z % tmp) + tmp) % tmp;
>                 r1=m1*z+r1;
>                 m1=m1/rnt*m2;
>                 r1%=m1;
> 
> 如果没有第三行的话,在第4行就会越界。加油吧————各位。

多谢了,看了这发现就是中间过程爆longlong,改了就AC

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