shunfurh 于 2017.09.10 00:03 提问

Lingo

You are going to participate in the television show 'lingo'. You are very confident that you will make the finals of the show. This is not only because you are well prepared, but also because you managed to find a way to use your pda unnoticed during the contest, and you have already written a program to help you with the bonuswords.

In the finals of the show, you first solve as many lingo words as possible within the allowed time. This determines how many balls you may take afterwards. The more balls you may take, the higher your probability is of winning the finals. But it is not easy to see what this probability is. Write a program to help you with this.

For those who don't know the game of lingo, here follows a description of the last part of the finals, where you take the balls. You are given a square grid. Some squares in this grid are covered and the other squares contain numbers. A hopper in front of you contains numbered balls; there is exactly one ball for each numbered grid square. You take a ball at random (without replacement) from this hopper for each lingo word you solved in the first part of the finals. When you take a ball, the corresponding square in the grid becomes covered. You win the finals if an entire row, column or diagonal consist of only covered squares.
Input

On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case:

One line with the integers n (1 <= n <= 8) and k (0 <= k), where n is the size of the lingo grid and k is the number of words you solved in the first part of the finals.

n lines, with on each line exactly n characters. Each character will be either '*' or '.', representing a covered square and a numbered square respectively.

There will be at least k numbered squares on the board, and there is no row, column or diagonal covered yet.

Output

For each test case:

One line with the percentage of getting lingo with either an absolute or a relative error of at most 10-6.

Sample Input

1
5 7
.*.*.
.**..
.*.*.
....
*
..*

Sample Output

82.703962704

1个回答

devmiao      2017.09.10 08:59

Lingo教育版免费申请流程
Lingo教育版申请流程（免费） 今天和队友在用Lingo求解一个非线性规划问题的时候，发现了网上目前流行比较广泛的Lingo11破解在运算速度上和运算结果上都存在误差，这里介绍一个Lingo的学生认证免费使用最新版的Lingo的流程。
Lingo基本使用方法
LP模型在Lingo中的一个典型输入方式： 1.以“MODEL:”开。 2.集合定义部分从(“SETS”到”ENDSETS”)定义集合及其属性。 3.给出优化目标和约束。 4.集合定义部分从(“DATA:”到”ENDDATA”)。 5.以”END”结束。目标函数的定义方法 @SUM(集合(下标)：关于集合的属性的表达式)约束的定义方法 循环函数：@FOR(集合(下标)：关于集合属性的约
lingo导入excel数据具体实现步骤
lingo导入excel数据的具体操作步骤
LINGO破解版
LINGO是用来求解线性和非线性优化问题的简易工具。LINGO内置了一种建立最优化模型的语言，可以简便地表达大规模问题，利用LINGO高效的求解器可快速求解并分析结果。

LINGO-错误代码大全
LINGO出错时错误代码含义：       在LINGO程序求解时，系统首先会对程序进行编译．系统在编译或执行其他命令 时，会因程序中的错误或运行错误，弹出一个出错报告窗口，显示其错误代码，并简要指 出错误的原因．这些错误报告信息能够提示用户发现程序中的错误，以便能尽快修改．下 面我们给出出错信息的一个简要说明，仅供参考． LINGO错误编号及原因对照表 错误代
lingo错误代码对照大全

lingo使用