Game Prediction
Suppose there are M people, including you, playing a special card game. At the beginning, each player receives N cards. The pip of a card is a positive integer which is at most N*M. And there are no two cards with the same pip. During a round, each player chooses one card to compare with others. The player whose card with the biggest pip wins the round, and then the next round begins. After N rounds, when all the cards of each player have been chosen, the player who has won the most rounds is the winner of the game.
Given your cards received at the beginning, write a program to tell the maximal number of rounds that you may at least win during the whole game.
Input
The input consists of several test cases. The first line of each case contains two integers m (2 ¡Ü m ¡Ü 20) and n (1 ¡Ü n ¡Ü 50), representing the number of players and the number of cards each player receives at the beginning of the game, respectively. This followed by a line with n positive integers, representing the pips of cards you received at the beginning. Then a blank line follows to separate the cases.
The input is terminated by a line with two zeros.
Output
For each test case, output a line consisting of the test case number followed by the number of rounds you will at least win during the game.
Sample Input
2 5
1 7 2 10 9
6 11
62 63 54 66 65 61 57 56 50 53 48
0 0
Sample Output
Case 1: 2
Case 2: 4
Game_Prediction.rar_Game Predicti_acm比赛题目
版权申诉
25 浏览量
2022-09-21
03:59:03
上传
评论
收藏 2KB RAR 举报
![avatar](https://profile-avatar.csdnimg.cn/d600a32f29294db1a3be82ec9708491a_weixin_42651887.jpg!1)
weixin_42651887
- 粉丝: 83
- 资源: 1万+
最新资源
- DS18B20温度传感器实战应用与源码解析.zip
- python-leetcode面试题解之第384题打乱数组.zip
- python-leetcode面试题解之第383题赎金信.zip
- python-leetcode面试题解之第380题O1插入删除和获取随机元素.zip
- python-leetcode面试题解之第375题猜数字大小II.zip
- python-leetcode面试题解之第374题猜数字大小.zip
- python-leetcode面试题解之第373题查找和最小的K对数字.zip
- python-leetcode面试题解之第372题超级次方.zip
- python-leetcode面试题解之第371题两整数之和.zip
- python-leetcode面试题解之第370题区间加法.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)