CF1603A.Di-visible Confusion
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
YouKn0wWho has an integer sequence a1,a2,…,an . He will perform the following operation until the sequence becomes empty: select an index i such that 1≤i≤∣a∣ and ai is not divisible by (i+1) , and erase this element from the sequence. Here ∣a∣ is the length of sequence a at the moment of operation. Note that the sequence a changes and the next operation is performed on this changed sequence.
For example, if a=[3,5,4,5] , then he can select i=2 , because a2=5 is not divisible by i+1=3 . After this operation the sequence is [3,4,5] .
Help YouKn0wWho determine if it is possible to erase the whole sequence using the aforementioned operation.
输入格式
The first line contains a single integer t ( 1≤t≤10000 ) — the number of test cases.
The first line of each test case contains a single integer n ( 1≤n≤105 ).
The second line of each test case contains n integers a1,a2,…,an ( 1≤ai≤109 ).
It is guaranteed that the sum of n over all test cases doesn't exceed 3⋅105 .
输出格式
For each test case, print "YES" (without quotes) if it is possible to erase the whole sequence using the aforementioned operation, print "NO" (without quotes) otherwise. You can print each letter in any register (upper or lower).
输入输出样例
输入#1
5 3 1 2 3 1 2 2 7 7 10 384836991 191890310 576823355 782177068 404011431 818008580 954291757 160449218 155374934 840594328 8 6 69 696 69696 696969 6969696 69696969 696969696
输出#1
YES NO YES YES NO
说明/提示
In the first test case, YouKn0wWho can perform the following operations (the erased elements are underlined): [1,2,3]→[1,3]→[3]→[].
In the second test case, it is impossible to erase the sequence as i can only be 1 , and when i=1 , a1=2 is divisible by i+1=2 .