Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int testcase;
- cin >> testcase;
- while (testcase--)
- {
- int input, temp,temp2, particle = 1, factor = 1, fact_temp=1, result;
- cin >> input;
- temp = input;
- while (temp)
- {
- temp = temp / 10;
- fact_temp = fact_temp * 10;
- }
- temp2=input;
- factor=fact_temp;
- while (factor > 1)
- {
- factor = factor / 10;
- result = temp2 / factor;
- if (result * factor != 0)
- {
- particle++;
- }
- temp2 = temp2 % factor;
- }
- cout << particle - 1 << endl;
- while (fact_temp > 1)
- {
- fact_temp = fact_temp / 10;
- result = input / fact_temp;
- if (result * fact_temp != 0)
- {
- cout << result * fact_temp << " ";
- }
- input = input % fact_temp;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement