运用C语言的编程功能实现猜数字的程序

Problem Description
If you hide some digits in an integer equation, you create a digit puzzle. The figure below shows two valid digit puzzles.Hidden digits are represented by squares, and other digits are shown. The numbers involved in this problem are all positive integers, written in decimal forms without leading zeros.


If a digit puzzle has a unique solution, we call it a good puzzle. Both puzzles shown above are good puzzles. The solution to the first puzzle is 7*12=84, while the solution to the second one is 11*11=121. You are already given some digit puzzles, but some of them are not good. Your task is to convert these puzzles into good ones. You can change any wildcard character (i.e. hidden digits) into a real digit, any real digit to a wildcard character, or
a real digit to another real digit, but you cannot insert or remove any character at any place. The number of changed characters should be minimized. In this problem, the puzzle is always in the form "a x b = c", and "a x b" and "b x a" should be considered different if a is not equal to b. It is allowed that all digits of both a and b are shown (e.g 12 x 34 = ****), though that puzzle is actually a simple multiplication problem. Write a program to make good puzzles.

Input
The input contains several test cases. Each test case contains three non-empty strings, x, y, z, having at most 2, 2 and 4 characters respectively. Each character is a digit or a wildcard '*', x will not begin with a zero character. The last test case is followed by a single zero, which should not be processed.

Output
For each test case, print the case number and the converted puzzle. If more than one optimal solution is found, the lexicographically first one should be printed (remember that "*" is before "0"). There is always a solution.

Sample Input
7 ** 8*


0

Sample Output
Case 1: 7 ** 8*
Case 2: ** ** 1*1

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
用C 语言编程,实现矩阵(3行3列)的转置(即行列互换)
3
运用C语言的编程的技术,编写一个程序,判断给定的两个数是否是亲和数
1
椭圆的半周长和面积的计算的方式,运用C语言的编程的技术的实现
0
数据结构对于棋盘的一个分割子的算法的问题,运用C语言技术的编程实现
0
数据结构里的剪枝算法的问题运用C语言编程技术的实现的做法
0
K维数字数组的一个算法的运用,如何利用C程序的编程语言的代码加以实现的呢
1
求助C语言的猜数字游戏
1
学弱求助C语言猜数字游戏
0
Excel可以对一组纪录按任意指定列排序。用C语言编程编写程序实现类似功能
0
符号逻辑数值计算问题,运用C程序的语言的编程的代码的实现的方式?
2
如何用C语言编程 猜数字小游戏最终版
0
计算箭头的角度的问题,运用的是C语言程序设计编程语言的方式去实现程序,如何来做?
0
涉及到文件的读写的统计问题,怎么运用C程序的语言编程代码的方式去实现的程序的呢?
0
编写一个猜数字的游戏的问题,根据输入判断大小,怎么用C语言的程序的过程实现的
0
如何实现功能,打开一个文件、运行一个.exe同时系统自动运行另外一个程序。C语言
0
Bricks C语言的程序编程
0
Trooper of Bam C语言程序编程
1
ubuntu下有没有能用C/C++语言实现texttospeech功能的代码?
2
单片机,倒计时,时钟设计,c语言编程
4
怎么给电脑安装C语言编程环境?