Răspuns :
****************************** prim007 **********************
#include <iostream>
using namespace std;
int a[20000], b[10001];
int main()
{
long long n,i, j, nrp=0, m=20000, num;
for (i = 2; i <= m; i++)
a[i] = 1;
for (i = 2; i*i <= m; i++)
if (a[i]!=0)
for (j = 2; j <= m / i; j++)
a[i*j] = 0;
cin >> n;
for (i=1; i<=n; ++i)
{
cin >> num; ++b[num];
}
if (b[0]*b[2]) nrp=nrp+b[0]*b[2];
if (b[1]) { m=b[1]-1; if (m%2) nrp=nrp+(m+1)/2*m;
else nrp=nrp+m/2*(m+1);}
for (i=0; i<9999; i+=2)
for (j=1; j<=9999; j+=2)
if (a[i+j]) nrp=nrp+b[i]*b[j];
cout << nrp;
return 0;
}
******************************* mincifre ****************************
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
ifstream f("mincifre.in");
ofstream g("mincifre.out");
char ch;
short fr[10], cif, i,j;
int main()
{
while (f>>ch)
{
cif=ch-'0';
++fr[cif];
}
if (fr[0]>0)
{
i=1;
while (fr[i]==0) ++i;
g << i;
--fr[i];
}
for (i=0; i<10; ++i)
{
for (j=1; j<=fr[i]; ++j)
{
g << i;
}
}
}