经典简约
清爽简洁,回归本真
液态水晶
毛玻璃+霓虹光带
赛博朋克
霓虹故障艺术风
🚫
违规操作检测
禁止使用右键菜单
⚠️ 此操作已被系统记录
1

bus

📝 题解 🔵 仅限 C++
题目描述
<p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">The final round of Bayan Programming Contest will be held in Tehran, and the participants will be carried around</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;with a yellow bus. The bus has 34 passenger seats: 4 seats in the last row and 3 seats in remaining rows.</span> </p> <p class="MsoNormal" align="center" style="text-align:center;background:white;"> <br /> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">The event coordinator has a list of&nbsp;</span><i><span style="font-size:14px;">k</span></i><span style="font-size:14px;">&nbsp;participants who should be picked up at the airport. When a participant</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;gets on the bus, he will sit in the last row with an empty seat. If there is more than one empty seat in that row,</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;he will take the leftmost one.</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">In order to keep track of the people who are on the bus, the event coordinator needs a figure showing which</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;seats are going to be taken by&nbsp;</span><i><span style="font-size:14px;">k</span></i><span style="font-size:14px;">&nbsp;participants. Your task is to draw the figure representing occupied seats.</span> </p>
输入格式
<p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">each line of input contains integer&nbsp;</span><i><span style="font-size:14px;">k</span></i><span style="font-size:14px;">,&nbsp;(0 ≤ </span><i><span style="font-size:14px;">k</span></i><span style="font-size:14px;"> ≤ 34), denoting the number of participants.</span> </p>
输出格式
<p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">Print the figure of a bus with&nbsp;</span><i><span style="font-size:14px;">k</span></i><span style="font-size:14px;">&nbsp;passengers as described in sample tests. Character '#' denotes an empty seat,</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;while 'O' denotes a taken seat. 'D' is the bus driver and other characters in the output are for the purpose of</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;beautifying the figure. Strictly follow the sample test cases output format. Print exactly six lines. Do not output</span> </p> <p class="MsoNormal" align="left" style="background:white;"> <span style="font-size:14px;">&nbsp;extra space or other characters.</span> </p>
样例
样例输入 1
9 20
样例输出 1
+------------------------+ |O.O.O.#.#.#.#.#.#.#.#.|D|) |O.O.O.#.#.#.#.#.#.#.#.|.| |O.......................| |O.O.#.#.#.#.#.#.#.#.#.|.|) +------------------------+ +------------------------+ |O.O.O.O.O.O.O.#.#.#.#.|D|) |O.O.O.O.O.O.#.#.#.#.#.|.| |O.......................| |O.O.O.O.O.O.#.#.#.#.#.|.|) +------------------------+
提交代码
请先登录后提交

🤖 AI 解题助手

DeepSeek
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这道题,可以帮你分析思路、提供代码示例。
⚠️ 请先登录后使用