-
Notifications
You must be signed in to change notification settings - Fork 0
/
A.cpp
60 lines (58 loc) · 1.05 KB
/
A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
bool isPrime(int n)
{
bool check=true;
for(int i=2;i*i<=n;i++)
{
if(n%i==0)
{
check=false;
break;
}
}
return check;
}
int main()
{
fastio;
int t,n,i,j,ara[105],b[105][105],sum,mx,ans[105];
cin>>t;
while(t--)
{
//mx=-1;
sum=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>ara[i];
sum+=ara[i];
}
if(!(isPrime(sum)))
{
cout<<n<<"\n";
for(i=1;i<=n;i++)
cout<<i<<" ";
cout<<"\n";
continue;
}
for(i=0;i<n;i++)
{
if(!(isPrime(sum-ara[i])))
{
mx=i;
break;
}
}
cout<<n-1<<"\n";
for(i=0;i<n;i++)
{
if(i==mx)
continue;
cout<<i+1<<" ";
}
cout<<"\n";
}
return 0;
}