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

wa了数十次终于用逆元过了

Posted by Tornado at 2011-07-20 09:47:37 on Problem 1845
In Reply To:Re:用逆元wa到不行 很想知道这道题有没有人用逆元过的啊~ Posted by:305636397 at 2011-07-05 10:03:31
要注意两种特殊情况:
x%9901==1的情况比较容易引起警觉,这种情况下不能用逆元,直接输出n+1就好了;
x%9901==0则比较隐蔽,因为通常都是求x^(n+1)%9901,然后再减一,一不注意就输出-1了
我一开始就注意到第一种了,结果在第二个错误上wa到吐血

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