-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeforces_1352A.cpp
More file actions
42 lines (37 loc) · 801 Bytes
/
codeforces_1352A.cpp
File metadata and controls
42 lines (37 loc) · 801 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
34
35
36
37
38
39
40
41
42
// Created by Rahul Sharma
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
bool isZero (int i) {
return i == 0;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t, size, k, count;
cin>>t;
vector<ll> v(t);
rep(i,t) {
cin>>v[i];
k=0;
count = 0;
size = trunc(log10(v[i])) + 1;
vector <ll> a(size);
for (int j=10; j<=pow(10,size+1); j*=10){
if(v[i]%j!=0){
a.push_back(v[i]%j);
v[i] -= v[i]%j;
count++;
}
}
cout << count << endl;
auto newIter = remove_if( a.begin() , a.end() , isZero);
a.resize(distance(a.begin(), newIter));
for (auto x:a) cout << x << " ";
cout <<endl;
}
return 0;
}