jakaria_hossain

codeforces - sum of the round numbers

May 10th, 2020
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  5.  
  6.  
  7. ll pro(ll i)
  8. {
  9. switch(i)
  10. {
  11. case 0:
  12. return 1;
  13. break;
  14. case 1:
  15. return 10;
  16. break;
  17. case 2:
  18. return 100;
  19. break;
  20. case 3:
  21. return 1000;
  22. break;
  23. case 4:
  24. return 10000;
  25. break;
  26. case 5:
  27. return 100000;
  28. break;
  29. case 6:
  30. return 1000000;
  31. break;
  32. case 7:
  33. return 10000000;
  34. break;
  35. case 8:
  36. return 100000000;
  37. break;
  38. default:
  39. return 1000000000;
  40. break;
  41. }
  42.  
  43. }
  44. int main()
  45. {
  46. fast()
  47. ll t;
  48. cin>>t;
  49. while(t--)
  50. {
  51. ll n;
  52. cin>>n;
  53. vector<ll>v;
  54. ll i=0;
  55. while(n>0)
  56. {
  57. ll s= n%10;
  58. if(s>0)
  59. {
  60. v.push_back(s*pro(i));
  61. }
  62. n/=10;
  63. i++;
  64. }
  65. cout<<v.size()<<endl;
  66. for(auto x: v)
  67. cout<<x<<" ";
  68. cout<<endl;
  69. }
  70. }
RAW Paste Data