Codeforces 1604C - Di-visible Confusion Solution
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,n,i,c,j,ans;
- cin>>t;
- while(t--)
- {
- c=0,ans=0;
- cin>>n;
- int a[n+9];
- for(i=1; i<=n; i++)cin>>a[i];
- for(i=1; i<=n; i++)
- {
- c=0;
- for(j=2; j<=i+1;j++)
- {
- if(a[i]%j!=0)
- {
- c=1;
- break;
- }
- }
- if(c==0)
- {
- ans=1;
- break;
- }
- }
- if(ans==1)
- cout<<"NO"<<endl;
- else
- cout<<"YES"<<endl;
- }
- }
No comments