Răspuns :
COROANA
#include <iostream>
using namespace std;
int main() {
int n, v[1001];
cin >> n;
for (int i = 1; i <= n; i++)
cin >> v[i];
for (int i = 1; i <= n; i++) {
int cv = v[i], d = 2, k = 1;
while (cv > 1) {
int p = 1;
while (cv % d == 0) {
cv /= d;
p++;
}
k *= p;
d++;
if (d * d > cv)
d = cv;
}
if (k == 2) {
for (int j = i + 1; j <= n; j++)
v[j - 1] = v[j];
n--;
i--;
}
}
for (int i = 1; i <= n; i++)
cout << v[i] << " ";
return 0;
}