欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1840B.Binary Cafe
Binary Cafe
Once upon a time, Toma found himself in a binary cafe. It is a very popular and unusual place.
The cafe offers visitors different delicious desserts. The desserts are numbered from to . The cost of the -th dessert is coins, because it is a binary cafe! Toma is willing to spend no more than coins on tasting desserts. At the same time, he is not interested in buying any dessert more than once, because one is enough to evaluate the taste.
In how many different ways can he buy several desserts (possibly zero) for tasting?
Input
The first line of the input contains a single integer () — the number of test cases.
Then follows lines, each of which describes one test case.
Each test case is given on a single line and consists of two integers and () — the number of coins Toma is willing to spend and the number of desserts in the binary cafe.
Output
Output integers, the -th of which should be equal to the answer for the -th test case — the number of ways to buy desserts for tasting.
Note
Variants for 1st sample: {}, {1}
Variants for 2nd sample: {}, {1}
Variants for 3rd sample: {}, {1}, {2}
Variants for 4th sample: {}, {1}, {2}, {1, 2}
Samples
5
1 2
2 1
2 2
10 2
179 100
2
2
3
4
180
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |