21775_WithoutZero

2022-5-16 18:20| 发布者: Hocassian| 查看: 41| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505835006400-Problem List-采集的数据-后羿采集器.html

Pro.ID

21775

Title

Without Zero

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21775

AC

6

Submit

25

Ratio

24.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Everyone is familiar to the natural number system: 1, 2, 3 … Today we will consider a different one: a no-zero number system, which means it only uses the digits 1 through 9. So counting begins with 1, the first "counting number", and continues: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12…, 19, 21…, 98, 99, 111, 112…

    So, in this system 9 is the ninth counting number and 11 is the tenth counting number. As usual, addition can be defined by reference to the counting sequence. Addition of the i-th counting number and the j-th counting number is defined to mean the (i+j)-th counting number. Thus, in this system 5 + 8 = 14, since 5 is the fifth counting number, 8 is the eighth, and 14 is the thirteenth counting number. Subtraction is the reverse of addition.

    Here is your task, given two numbers: a and b, you should output a subtract b which is defined in no-zero number system.

    输入

    Multiple test cases, each line contains two positive integers: a and b, 1 ≤ b < a < 1000000000, it is guaranteed that both a and b will not contain digit 0.

    输出

    Description

    Everyone is familiar to the natural number system: 1, 2, 3 … Today we will consider a different one: a no-zero number system, which means it only uses the digits 1 through 9. So counting begins with 1, the first "counting number", and continues: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12…, 19, 21…, 98, 99, 111, 112…

    So, in this system 9 is the ninth counting number and 11 is the tenth counting number. As usual, addition can be defined by reference to the counting sequence. Addition of the i-th counting number and the j-th counting number is defined to mean the (i+j)-th counting number. Thus, in this system 5 + 8 = 14, since 5 is the fifth counting number, 8 is the eighth, and 14 is the thirteenth counting number. Subtraction is the reverse of addition.

    Here is your task, given two numbers: a and b, you should output a subtract b which is defined in no-zero number system.

    Input

    Multiple test cases, each line contains two positive integers: a and b, 1 ≤ b < a < 1000000000, it is guaranteed that both a and b will not contain digit 0.

    Output

    One line for each case, the result of a subtract b which is defined in no-zero number system.

    Sample Input

    14 5
    111 99
    191 111

    Sample Output

    8
    1
    79

    Source

    样例输入

    14 5
    111 99
    191 111

    样例输出

    8
    1
    79

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部