欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1358A.Park Lighting
Park Lighting
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
The park is a rectangular table with rows and columns, where the cells of the table are squares, and the boundaries between the cells are streets. External borders are also streets. Every street has length . For example, park with has streets.
You were assigned to develop a plan for lighting the park. You can put lanterns in the middle of the streets. The lamp lights two squares near it (or only one square if it stands on the border of the park).
The park sizes are: , . The lighted squares are marked yellow. Please note that all streets have length . Lanterns are placed in the middle of the streets. In the picture not all the squares are lit.
Semyon wants to spend the least possible amount of money on lighting but also wants people throughout the park to keep a social distance. So he asks you to find the minimum number of lanterns that are required to light all the squares.
Input
The first line contains a single integer () — the number of test cases in the input. Then test cases follow.
Each test case is a line containing two integers , () — park sizes.
Output
Print answers to the test cases. Each answer must be a single integer — the minimum number of lanterns that are required to light all the squares.
Note
Possible optimal arrangement of the lanterns for the -nd test case of input data example: 
Possible optimal arrangement of the lanterns for the -rd test case of input data example: 
Samples
5
1 1
1 3
2 2
3 3
5 3
1
2
2
5
8
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |