编程介的小学生 2019-05-29 17:51 采纳率: 20.5%
浏览 178

数值的矩阵变换和计算的问题,怎么采用C语言的程序设计来实现计算的数字,具体的代码怎么做

Problem Description
In the Price Is Right’s game Cover Up, players test their luck to win a new car. To win, the player must produce the actual retail price of the car from a board of possible numbers like:

The player selects one number from each column to form a bid. Using the above board as an example, the first number in the price of the car is either 1 or 3; the second is one of 9, 4, 2; the third is one of 0, 6, 8, 4; and so on. Numbers may never move to a different column.

After the player selects their bid, Drew Carey lights up the numbers in the bid which are correct. If the player has no numbers correct, the game ends and they lose; if they have at least one number correct, the game continues.

When the game continues, the player is given another opportunity to select numbers from those columns that were incorrect. They will cover up the wrong bid numbers with different selections from the same columns. Again, Drew Carey will light up any new correct digits. If the player has no new numbers correct, the game ends and they lose; if they have at least one new number correct, the game continues.

For example:

The player selects an initial bid of 14677.The1,4andfirst7arecorrect(cstandsforcorrect,xforincorrect,andvdesignatesacolumnthatrequiresasubsequentselectionintheexampleabove).Theplayercoversuptheincorrect6and7withan8anda3forasecondbidof14873. The 3 is correct, but the 8 is wrong. At this point it's a 50/50 chance. The player will select the 4 or the 0 and either win the car or lose the game.

The show's sponsors would like to know how frequently their cars are given away. You are to use the assumption that players choose numbers uniformly from those remaining.

Input
The sponsor will explore many variations, with prices up to 7 digits long. Therefore, the input file will begin with a line containing the integer N <= 5000, the number of test cases to be explored. The test cases follow.

Each test case begins with the integer d, 0 < d <= 7, the number of digits in the price of the car. d lines will follow, with non-empty strings of distinct digits in the range from 0 through 9. Each of these lines represents a column of the digits in the game. The first line represents the leftmost column; the last the rightmost column. A 0 is possible as the first digit in the price of the car.

Output
Your program will print the probability of the player winning the car, rounded to 3 decimals.

Sample Input
2
2
9
19
5
13
942
0684
34720
947368

Sample Output
1.000
0.321

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100