22234_TournamentSeeding

2022-5-16 18:21| 发布者: Hocassian| 查看: 25| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506221079500-Problem List-采集的数据-后羿采集器.html

Pro.ID

22234

Title

Tournament Seeding

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22234

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    In many competitions, players are given seeding numbers to represent their relative strength, where the best player is given seed #1, the second best is given seed #2, etc. The seeding of a single elimination tournament is an arrangement of matches which keeps the best players from playing each other until as late as possible (the last round with players seeded 1 and 2). Define the strength for a match as the sum of the two seeds in the match, and the ideal strength as the strength for the match assuming the best two players make it to that match (or in other words, the minimum sum of the two seeds which could play in that match). The total number of rounds r needed for a tournament of n contestants is given by the formula . If we call the finals of the tournament round r, the semi-finals round r-1, etc., then the way in which seeding is done can be described as follows: in round k, we arrange players such that the ideal match strength for all matches in that round is 2r-k+1+1. For example, the seeding of a match of 13 people would look as follow:

    You are asked to solve the following problem: given the values of n and m, determine the earliest round in a tournament of n players in which a match strength of m could occur. You may assume that the seeding is done in the manner described above.

    输入

    You will be given a number of cases in the input. Each case will be specified on one line, consisting of two integers n and m, where 2 ≤ n ≤ 100 and m ≥ 3. You may assume in each case that a match strength of m can occur during some round. Input is terminated by a case in which n = m = 0.

    输出

    Description

    In many competitions, players are given seeding numbers to represent their relative strength, where the best player is given seed #1, the second best is given seed #2, etc. The seeding of a single elimination tournament is an arrangement of matches which keeps the best players from playing each other until as late as possible (the last round with players seeded 1 and 2). Define the strength for a match as the sum of the two seeds in the match, and the ideal strength as the strength for the match assuming the best two players make it to that match (or in other words, the minimum sum of the two seeds which could play in that match). The total number of rounds r needed for a tournament of n contestants is given by the formula . If we call the finals of the tournament round r, the semi-finals round r-1, etc., then the way in which seeding is done can be described as follows: in round k, we arrange players such that the ideal match strength for all matches in that round is 2r-k+1+1. For example, the seeding of a match of 13 people would look as follow:

    You are asked to solve the following problem: given the values of n and m, determine the earliest round in a tournament of n players in which a match strength of m could occur. You may assume that the seeding is done in the manner described above.

    Input

    You will be given a number of cases in the input. Each case will be specified on one line, consisting of two integers n and m, where 2 ≤ n ≤ 100 and m ≥ 3. You may assume in each case that a match strength of m can occur during some round. Input is terminated by a case in which n = m = 0.

    Output

    For each test case, print the case number and the earliest round for that case in the format shown below.

    Sample Input

    100 3
    13 10
    0 0

    Sample Output

    Case 1: Round 7
    Case 2: Round 2

    Source

    样例输入

    100 3
    13 10
    0 0

    样例输出

    Case 1: Round 7
    Case 2: Round 2

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部