10030_AFamousEquation

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

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

Pro.ID

10030

Title

A Famous Equation

Title链接

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

AC

3

Submit

3

Ratio

100.00%

时间&空间限制

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

    Mr. B writes an addition equation such as 123+321=444 on the blackboard after class. Mr. G removes some of the digits and makes it look like "1?3+??1=44?". Here "?" denotes removed digits. After Mr. B realizes some digits are missing, he wants to recover them. Unfortunately, there may be more than one way to complete the equation. For example "1?3+??1=44?" can be completed to "123+321=444" , "143+301=444" and many other possible solutions. Your job is to determine the number of different possible solutions.

    输入

    Each test case describes a single line with an equation like a+b=c which contains exactly one plus sign "+" and one equal sign "=" with some question mark "?" represent missing digits. You may assume a, b and c are non-negative integers, and the length of each number is no more than 9. In the other words, the equation will contain three integers less than 1,000,000,000.

    输出

    Description

    Mr. B writes an addition equation such as 123+321=444 on the blackboard after class. Mr. G removes some of the digits and makes it look like "1?3+??1=44?". Here "?" denotes removed digits. After Mr. B realizes some digits are missing, he wants to recover them. Unfortunately, there may be more than one way to complete the equation. For example "1?3+??1=44?" can be completed to "123+321=444" , "143+301=444" and many other possible solutions. Your job is to determine the number of different possible solutions.

    Input

    Each test case describes a single line with an equation like a+b=c which contains exactly one plus sign "+" and one equal sign "=" with some question mark "?" represent missing digits. You may assume a, b and c are non-negative integers, and the length of each number is no more than 9. In the other words, the equation will contain three integers less than 1,000,000,000.

    Output

    For each test case, display a single line with its case number and the number of possible solutions to recover the equation.

    Sample Input

    7+1?=1?
    ?1+?1=22

    Sample Output

    7+1?=1?
    ?1+?1=22

    Hint

    There are three solutions for the first case:

    7+10=17, 7+11=18, 7+12=19

    There is only one solution for the second case:

    11+11=22

    Note that 01+21=22 is not a valid solution because extra leading zeros are not allowed.

    Source

    样例输入

    7+1?=1?
    ?1+?1=22

    样例输出

    7+1?=1?
    ?1+?1=22

    提示

    There are three solutions for the first case:

    7+10=17, 7+11=18, 7+12=19

    There is only one solution for the second case:

    11+11=22

    Note that 01+21=22 is not a valid solution because extra leading zeros are not allowed.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部