Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("nrcurat.in");
ofstream fout("nrcurat.out");
int n,i=0,v[1001],urma,ogl,nr,x;
int main()
{ while(fin>>n)
{ i++;
v[i]=n;
}
n=i;
for(i=1;i<=n;i++)
{ x=v[i];
nr=0;
ogl=0;
urma=0;
while(x)
{ nr++;
ogl=ogl*10+x%10;
x=x/10;
}
while(nr!=0)
{ urma=urma*10+9;
nr--;
}
if(ogl==(urma-v[i]))
fout<<"1"<<" ";
else
fout<<"0"<<" ";
}
return 0;
}