306623: CF1225A. Forgetting Things

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Forgetting Things

题意翻译

### 题意简述 求不定方程 $$a+1=b$$ 且 $a$ 的第一位为 $d_a$,$b$ 的第一位为 $d_b$ 的一组解。 ### 输入格式 一行,$d_a,d_b(1\leq d_a,d_b\leq 9)$。 ### 输出格式 如果无解请输出 $-1$。 否则请输出 $a,b$。如果有多组解满足条件请输出任意一组。**请注意,输出的 $a,b$ 还必须满足 $1\leq a < b \leq 10^9$**。 翻译贡献者:Meatherm (U108949)

题目描述

Kolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation $ a + 1 = b $ with positive integers $ a $ and $ b $ , but Kolya forgot the numbers $ a $ and $ b $ . He does, however, remember that the first (leftmost) digit of $ a $ was $ d_a $ , and the first (leftmost) digit of $ b $ was $ d_b $ . Can you reconstruct any equation $ a + 1 = b $ that satisfies this property? It may be possible that Kolya misremembers the digits, and there is no suitable equation, in which case report so.

输入输出格式

输入格式


The only line contains two space-separated digits $ d_a $ and $ d_b $ ( $ 1 \leq d_a, d_b \leq 9 $ ).

输出格式


If there is no equation $ a + 1 = b $ with positive integers $ a $ and $ b $ such that the first digit of $ a $ is $ d_a $ , and the first digit of $ b $ is $ d_b $ , print a single number $ -1 $ . Otherwise, print any suitable $ a $ and $ b $ that both are positive and do not exceed $ 10^9 $ . It is guaranteed that if a solution exists, there also exists a solution with both numbers not exceeding $ 10^9 $ .

输入输出样例

输入样例 #1

1 2

输出样例 #1

199 200

输入样例 #2

4 4

输出样例 #2

412 413

输入样例 #3

5 7

输出样例 #3

-1

输入样例 #4

6 2

输出样例 #4

-1

Input

题意翻译

### 题意简述 求不定方程 $$a+1=b$$ 且 $a$ 的第一位为 $d_a$,$b$ 的第一位为 $d_b$ 的一组解。 ### 输入格式 一行,$d_a,d_b(1\leq d_a,d_b\leq 9)$。 ### 输出格式 如果无解请输出 $-1$。 否则请输出 $a,b$。如果有多组解满足条件请输出任意一组。**请注意,输出的 $a,b$ 还必须满足 $1\leq a < b \leq 10^9$**。 翻译贡献者:Meatherm (U108949)

加入题单

算法标签: