-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPP0319.cpp
More file actions
51 lines (50 loc) · 1.06 KB
/
CPP0319.cpp
File metadata and controls
51 lines (50 loc) · 1.06 KB
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
43
44
45
46
47
48
49
50
51
#include <bits/stdc++.h>
#define MAX 10000001
#define ll long long
#define fastsync() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
const int mod = 1e9 + 7;
using namespace std;
int main() {
fastsync();
int m, s;
cin >> m >> s;
if (s > 9 * m || (s == 0 && m >= 2)) {
cout << -1 << ' ' << -1;
return 0;
}
int big[m], small[m];
int tmp = s;
for (int i = 0; i < m; i++) {
if (s >= 9) {
big[i] = 9;
s -= 9;
}
else {
big[i] = s;
s = 0;
}
}
--tmp;
for (int i = m - 1; i > 0; i--) {
if (tmp >= 9) {
small[i] = 9;
tmp -= 9;
}
else {
small[i] = tmp;
tmp = 0;
}
}
small[0] = tmp + 1;
for (int i = 0; i < m; i++) {
cout << small[i];
}
cout << ' ';
for (int i = 0; i < m; i++) {
cout << big[i];
}
return 0;
}