示例#1
0
def test_crt():
    def mcrt(m, v, r, symmetric=False):
        assert crt(m, v, symmetric)[0] == r
        mm, e, s = crt1(m)
        assert crt2(m, v, mm, e, s, symmetric) == (r, mm)

    mcrt([2, 3, 5], [0, 0, 0], 0)
    mcrt([2, 3, 5], [1, 1, 1], 1)

    mcrt([2, 3, 5], [-1, -1, -1], -1, True)
    mcrt([2, 3, 5], [-1, -1, -1], 2*3*5 - 1, False)

    assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
    assert crt([12, 6, 17], [3, 4, 2]) is None
示例#2
0
def test_crt():
    def mcrt(m, v, r, symmetric=False):
        assert crt(m, v, symmetric)[0] == r
        mm, e, s = crt1(m)
        assert crt2(m, v, mm, e, s, symmetric) == (r, mm)

    mcrt([2, 3, 5], [0, 0, 0], 0)
    mcrt([2, 3, 5], [1, 1, 1], 1)

    mcrt([2, 3, 5], [-1, -1, -1], -1, True)
    mcrt([2, 3, 5], [-1, -1, -1], 2*3*5 - 1, False)

    mcrt([99, 97, 95], [49, 76, 65], 639985)

    assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
    assert crt([12, 6, 17], [3, 4, 2]) is None
示例#3
0
def test_crt():
    def mcrt(m, v, r, symmetric=False):
        assert crt(m, v, symmetric)[0] == r
        mm, e, s = crt1(m)
        assert crt2(m, v, mm, e, s, symmetric) == (r, mm)

    mcrt([2, 3, 5], [0, 0, 0], 0)
    mcrt([2, 3, 5], [1, 1, 1], 1)

    mcrt([2, 3, 5], [-1, -1, -1], -1, True)
    mcrt([2, 3, 5], [-1, -1, -1], 2 * 3 * 5 - 1, False)

    assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
示例#4
0
 def mcrt(m, v, r, symmetric=False):
     assert crt(m, v, symmetric)[0] == r
     mm, e, s = crt1(m)
     assert crt2(m, v, mm, e, s, symmetric) == (r, mm)
示例#5
0
 def mcrt(m, v, r, symmetric=False):
     assert crt(m, v, symmetric)[0] == r
     mm, e, s = crt1(m)
     assert crt2(m, v, mm, e, s, symmetric) == (r, mm)