A game of numbers has the following rules: at the beginning, two distinct positive integers are given by the judge. Then each player in turn must give a number to the judge. The number must be the difference of two numbers that are previously given, and must not be duplicated to any of the existed numbers. The game will run for several rounds. The one who gives a duplicate number or even a wrong number will be kicked out.
Your job is to write a judger program to judge the players' numbers and to determine the final winners.
Input Specification:
Each input file contains one test case. For each case, the first line gives two distinct positive integers to begin with. Both numbers are in [1,105].
In the second line, two numbers are given: N (2≤N≤10), the number of players, and M (2≤M≤103), the number of rounds.
Then N lines follow, each contains M positive integers. The i-th line corresponds to the i-th player (i=

这是一个数字游戏,初始给定两个正整数,玩家按顺序报数,报的数必须是之前两个数的差且不能重复。玩家报错或报重复数将被淘汰。程序需判断游戏结果并输出最后的赢家。输入包含游戏开始的两个数、玩家数量、轮数及每轮玩家的报数。输出淘汰情况和最终赢家。
最低0.47元/天 解锁文章
425

被折叠的 条评论
为什么被折叠?



