-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1714C.cpp
More file actions
40 lines (33 loc) · 927 Bytes
/
1714C.cpp
File metadata and controls
40 lines (33 loc) · 927 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
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int s;
cin>>s;
stack<int> stack;
for(int i=9;i>=1 && s ;i++){
if(s>=i){
stack.push(i);
s-=i;
}
else{
stack.push(s);
}
}
while(!stack.empty()) {
cout<< stack.top();
stack.pop();
cout<<endl;
}
}
return 0;
}