Răspuns :
Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
int v[10000];
int main()
{
ifstream f("numere8.in");
ofstream g("numere8.out");
int n;
while (f >> n)
{
if (n<10000) v[n]=1;
}
for (int i=9999; i>=1; --i)
if (v[i]==0) g << i << " ";
return 0;
}
Explicație:
Răspuns:
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("numere8.in");
ofstream fout ("numere8.out");
int v[10000];
int main()
{
long long x,i;
while (fin>>x)
{
if (x<10000)
v[x]++;
}
for (i=9999;i>=1;i--)
if (v[i]==0)
fout<<i<<" ";
return 0;
}
Explicație: