fork(2) download
  1. #include <iostream>
  2. #include <math.h>
  3. #include<stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n;
  10. cin>>n; cout<<endl;
  11. for(int i=1 ; i<=n ; i++)
  12. {
  13. int licznik=0, liczba;
  14. cin>>liczba; cout<<endl;
  15.  
  16. if(liczba%10 == liczba/10%10 || (liczba>0 && liczba<10))
  17. {
  18. cout<<liczba<<" "<<'0'<<endl;
  19. }
  20.  
  21. else
  22. {
  23. int ilosc = log10(liczba)+1, odwrocona=0, k=1,b=0;
  24. for(int j=2 ; j<=ilosc ; j++)
  25. {
  26. k*=10;
  27. }
  28. cout<<k<<endl;
  29. for(int j=0 ; j<ilosc ; j++)
  30. {
  31. cout<<odwrocona<<"\t";
  32. odwrocona+=(liczba/k%10)*pow(10,j);
  33. cout<<odwrocona<<endl;
  34. k/=10;
  35. }
  36. cout<<"\n\n\n"<<odwrocona<<"\n\n";
  37. }
  38.  
  39. }
  40.  
  41. return 0;
  42. }
  43.  
  44.  
Success #stdin #stdout 0s 4476KB
stdin
Standard input is empty
stdout