Count sequences of nondecreasing cut heights where each cut divides the object's height, modulo 1000000007.
Medium7Dynamic programmingNumber theoryNo attempts yetTime limit2sMemory limit128 MBSeunggyun, a swordsman who outlives his era, trained a new technique called the Heavenly Dragon Flash to sharpen his school, the Alps Sword Style.
The Heavenly Dragon Flash cuts the N objects in front of him one at a time, in the order they stand. The cutting height never drops from one cut to the next. It either stays the same or goes higher.
The remarkable part of the technique is that the height of an object divided by the height of the cut always comes out as a whole natural number. Seunggyun can also cut an object at exactly its own height. Height 0 cannot be cut.
Say three objects of heights 2, 4 and 6 stand in front of him. He can cut them at heights 1, 2 and 3, because 2 is divisible by 1, 4 by 2, 6 by 3, and the cutting height never drops. For the same reason 1, 1, 1 works, and so does 2, 4, 6, which he uses to show off his precision.
To see how much the Heavenly Dragon Flash is capable of, Seunggyun wants the number of ways to cut all N objects. The example above has 12 ways.
He never learned numbers, so he cannot count them himself. Count the ways for him.
The input holds several test cases.
The first line contains the number of test cases T. (1≤T≤30)
The first line of each test case contains the number of objects N. (1≤N≤300)
The second line contains the N object heights H1,H2,…,HN, separated by spaces. (1≤Hi≤1000000)
For each test case, print on its own line the number of ways Seunggyun can cut the objects, modulo 1000000007.