Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
O(1)方法公式的来源可以参考Wikipedia上线性同余同方程的解法,方法很简单手算一会就出来了。 http://en.wikipedia.org/wiki/Linear_congruence_theorem 也可以参考中国同余定理:http://en.wikipedia.org/wiki/Chinese_remainder_theorem 方程解出来是 x = 21252 * k - 504504 * p + 503217 * e + 1288 * i; 再简单利用余数的性质调整一下就能出: x = (21252 + 5544 * p + 14421 * e + 1288 * i - d) % 21252; Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator