[转载]POJ 2635 The Embarrassed Cryptographer [高精度求余+同余模定理]【数论】

2016-04-29 14:45:29 Tabris_ 阅读数：375

https://blog.csdn.net/qq_33184171/article/details/51281788

ACMer与Coder的交流分享地

POJ2635-The Embarrassed Cryptographer

1、 Char格式读入K。把K转成千进制Kt，同时变为int型。

2、 素数打表，把10^6内的素数全部预打表，在求模时则枚举到小于L为止。

3、 高精度求模。

Source修正：

Nordic 2005

http://ncpc.idi.ntnu.no/

Sample Input

143 10
143 20
667 20
667 30
2573 30
2573 40
4 2
6 3
6 3
15 3
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 2
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 3
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 999981
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 999982
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 999983
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 999984
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999536689 999985
9936798836621706335903766366605021199756127575438907144689843371764114998372849970522970722679648297 1000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999924165887 1000000
9999999999999999997709341477512928270733515750111494296807693217401592660013176273247584305454312971 1000000
9999999999988881245087379264540384030358544520360773252628174690915590034078934845096473005364364269 1000000
9999999999999999999999999999999999999999999999999999999999999999999997947710886296926452585995644787 1000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998743929569 1000000
9999999999999999999999999999999999999999999999999999999999999999999999996406876316697599258447653751 1000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995271511 1000000
9999664515006205757944572422495695942633452678405393581216966782816097132509526872495414067984894021 1000000
0 0

Sample Output

GOOD
GOOD
GOOD
GOOD
GOOD
GOOD
GOOD
GOOD
GOOD
GOOD