编程介的小学生 2017-08-05 08:27 采纳率: 20.5%
浏览 761
已采纳

Square Lottery

The government of the United Republic of Little Tower is developing a new kind of lottery. The main purpose of the lottery is to raise money to build Little Tower's Olympic Stadium, for an attendance of 400,000 people. The stadium is strategic for Little Tower's proposal to host the World Cup Finals in 2078.

The lottery will run weekly. Each week, tickets in the form of square cards will be sold. Each ticket will have squares with printed numbers within, in a sequence of N rows and N columns, as shown in Figure 1.

In each ticket no number appears twice, and therefore all numbers from 1 to N^2 are present (in random positions). No two tickets sold in the same week will be equal. Nevertheless, all possible different tickets will be sold, since Little Tower's citizens love lotteries. Tickets will be sold for T$1.00 (one Torreal, Little Tower's monetary unit).

To choose the winner(s), four numbers (between 1 and N^2) will be picked randomly, and the ticket(s) whose chosen numbers positions are corners of a square will be awarded the prize money. For example, the ticket shown in Figure 1 is a winning ticket if the numbers picked are (6, 3, 2, 9), (1, 4, 2, 5) or (7, 8, 9, 6), but it is not a winning ticket if the numbers picked are (1, 7, 2, 9). If more than one ticket is a winner, customers who bought those tickets will share the week's lottery prize.

The government of Little Tower asks your help to determine the prize value to be payed for each winning ticket, for a given N, and a given percentage, over the total amount received for the tickets, that the government wants to pay as prizes.

Input

Input will contain several test cases. Each test case is described in a line containing two integers N and P, representing respectively the number of rows (and columns) of tickets, and the percentage of the money received that will be payed as prize (2 <= N <= 100 and 0 <= P <= 100). The end of input is indicated by N = P = 0.

Output

For each test case in the input your program should produce one line of output, containing a real value representing the prize to be payed to each winning ticket. The prize value must be printed with twodigit precision, and the last decimal digit must be rounded. The input will not contain test cases where differences in rounding are significant.

Sample Input

2 100
2 80
3 50
0 0

Sample Output

1.00
0.80
10.50

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记