Problem 2524 --Buy the Ticket

2524: Buy the Ticket

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $3$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 数学
The "Harry Potter and the Goblet of Fire" will be on show in the next few days. As a crazy fan of Harry Potter, you will go to the cinema and have the first sight, won’t you?

Suppose the cinema only has one ticket-office and the price for per-ticket is 50 dollars. The queue for buying the tickets is consisted of m + n persons (m persons each only has the 50-dollar bill and n persons each only has the 100-dollar bill).

Now the problem for you is to calculate the number of different ways of the queue that the buying process won't be stopped from the first person till the last person. 
Note: initially the ticket-office has no money. 

The buying process will be stopped on the occasion that the ticket-office has no 50-dollar bill but the first person of the queue only has the 100-dollar bill.
The input file contains several test cases. Each test case is made up of two integer numbers: m and n. It is terminated by m = n = 0. Otherwise, m, n <=100.

For each test case, first print the test number (counting from 1) in one line, then output the number of different ways in another line.

3 0
3 1
3 3
0 0
Test #1:
6
Test #2:
18
Test #3:
180

推荐代码 查看2524 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$5 $ms] 淡意的温柔 606303 2020-07-09 14:53:39
内存最少[$2084 $KB] 淡意的温柔 606304 2020-07-09 14:53:53
第一AC 计爱玲 201443 2018-02-03 18:31:55
第一挑战 计爱玲 201443 2018-02-03 18:31:55

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛