Lucian_Adrian

#3303 nrcurat

Oct 19th, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("nrcurat.in");
  5. ofstream fout("nrcurat.out");
  6. int n,i=0,v[1001],urma,ogl,nr,x;
  7. int main()
  8. {
  9. while(fin>>n)
  10. { i++;
  11. v[i]=n;
  12. }
  13. n=i;
  14. for(i=1;i<=n;i++)
  15. { x=v[i];
  16. nr=0;
  17. ogl=0;
  18. urma=0;
  19. while(x)
  20. { nr++;
  21. ogl=ogl*10+x%10;
  22. x=x/10;
  23. }
  24. while(nr!=0)
  25. { urma=urma*10+9;
  26. nr--;
  27. }
  28. if(ogl==(urma-v[i]))
  29. fout<<"1"<<" ";
  30. else
  31. fout<<"0"<<" ";
  32. }
  33.  
  34. return 0;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment