-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1352A.cpp
More file actions
33 lines (32 loc) · 793 Bytes
/
1352A.cpp
File metadata and controls
33 lines (32 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
#include<math.h>
#include<cmath>
#include<set>
using namespace std;
int main(){
int t, n, res=0, j=0, counter=0, aux=0;
set<int> numbers;
cin >> t;
for(int i=0; i<t; i++){
cin >> n;
while(n!=0){
res = n%10;
if (res != 0){
aux = ceil(res * pow(10.0, j));
numbers.insert(aux);
counter++;
} n/=10;
j++;
}
cout << counter << endl;
set <int>::iterator itr;
int k = 1;
for(itr = numbers.begin(); itr != numbers.end(); itr++){
(k < numbers.size()) ? cout << *itr << " " : cout << *itr << endl;
k++;
}
numbers.clear();
counter = 0;
j = 0;
} return 0;
}