B. Unnatural Conditions
Time limit1000 ms | Memory limit262144 kB |
---|
Description
Let s(x)s(x) be sum of digits in decimal representation of positive integer xx. Given two integers nn and mm, find some positive integers aa and bb such that
s(a)≥n,
s(b)≥n,
s(a+b)≤m.
Input
The only line of input contain two integers nn and mm (1≤n,m≤1129).
Output
Print two lines, one for decimal representation of aa and one for decimal representation of bb. Both numbers must not contain leading zeros and must have length no more than 2230.
input
6 5
output
6
7
input
8 16
output
35
53
Note
In the first sample, we have n=6 and m=5. One valid solution is a=6, b=7. Indeed, we have s(a)=6≥n and s(b)=7≥n, and also s(a+b)=s(13)=4≤m.
可以任意构造多位数,只要比 n 大,a+b 的和最小,尽量让每一位都为 0,所以最优情况每一位和进位为 0,最后只有一个 1。
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <complex>
using namespace std;
const int N=1e5;
int main()
{
int n,m;
scanf("%d%d", &n, &m);
for(int i=0; i<n; i++)
printf("5");
printf("\n");
for(int j=0; j<n-1; j++)
printf("4");
printf("5\n");
return 0;
}