예제 #1
0
        public void Combination()
        {
            var factor = new StaticModIntFactor <Mod1000000007>(10);

            for (int i = 0; i <= 10; i++)
            {
                for (int j = 0; j <= 10; j++)
                {
                    factor.Combination(i, j).Value.Should().Be((int)MathLibEx.Combination(i, j));
                }
            }
            factor.Invoking(factor => factor.Combination(11, 0)).Should().Throw <Exception>();
        }
예제 #2
0
        public void Homogeneous()
        {
            var factor = new StaticModIntFactor <Mod1000000007>(30);

            for (int i = 0; i <= 10; i++)
            {
                for (int j = 0; j <= 20; j++)
                {
                    factor.Homogeneous(i, j).Should().Be(factor.Combination(i + j - 1, j));
                }
            }
            factor.Invoking(factor => factor.Homogeneous(10, 22)).Should().Throw <Exception>();
        }