Pb 1
#include <iostream>
using namespace std;
bool prim(int y)
{
int d;
if(y<2)
return false;
if(y==2)
return true;
for(d=2;d<=y/2;d++)
if(y%d==0)
return false;
return true;
}
int main()
{
int v[101],n,x=1,aux;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>v[i];
if(prim(v[x]))
x++;
else
if(prim(v[i]))
{
aux=v[i];
for(int j=i-1;j>=x;j--)
v[j+1]=v[j];
v[x]=aux;
x++;}
}
for(int i=1;i<=n;i++)
cout<<v[i]<<" ";
return 0;
}
Pb 2
#include <iostream>
using namespace std;
int main()
{
int v[101],n,ok=1;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>v[i];
if(v[i]<10 || v[i]>99)
{
ok=0;
break;
}
}
if(ok==1)
cout<<"DA";
else
cout<<"NU";
return 0;
}