当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1900:Game

Special Judge 特殊评判
题目描述
There is a legend that mathematicians in the XVIII century enjoyed playing the following game.

The game was played by three mathematicians. One of them was the game master. First of all, the game master declared some positive integer number N . After that he chose two different integer numbers X and Y ranging from 1 to N and told their sum to one player and their product to the other player. Each player knew whether he was told the sum or the product of the chosen numbers.

After that the players in turn informed the game master whether they knew the numbers he had chosen. First the player who was told the sum said whether he knew the numbers, after that the player who was told the product did, and so on.

For example the dialog could look like this:

Game master: "Let N be 10".

After that he chooses two numbers ranging from 1 to 10 and tells their sum to player S and their product to player P.

Player S: "I don't know these numbers."

Player P: "I don't know these numbers."

Player S: "I don't know these numbers."

Player P: "I don't know these numbers."

Player S: "Oh, now I know these numbers. You have chosen 3 and 6."

Given N and M -- the number of times the players have said "I don't know these numbers", you have to find all possible pairs of numbers that could have been chosen by the game master.

输入解释
The first line of the input contains N and M (2 <= N <= 200, 0 <= M <= 100).
输出解释
First output number of possible pairs of numbers that could have been chosen by the game master from the range 1 to N if both players altogether had said "I don't know these numbers" M times. After that output these pairs in arbitrary order, one on a line.
输入样例
10 4
输出样例
3
2 5
3 6
3 10

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1900

最后修改于 2020-10-29T06:17:11+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 60000