POJ 2891 Strange Way to Express Integers

来源:互联网 发布:psv舰队 淘宝 编辑:程序博客网 时间:2024/06/10 15:13

Description
Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:
Choose k different positive integers a1, a2, …, ak. For some non-negative m, divide it by every ai (1 ≤ i ≤ k) to find the remainder ri. If a1, a2, …, ak are properly chosen, m can be determined, then the pairs (ai, ri) can be used to express m.
“It is easy to calculate the pairs from m, ” said Elina. “But how can I find m from the pairs?
Since Elina is new to programming, this problem is too difficult for her. Can you help her?


【题目分析】
典型的中国剩余定理,由于方程数目比较多,只需要两两合并就可以了,完全不需要记录。


0 0