denis_andrei10

mayasi

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