A11647 | Choose Place
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
A classroom in a school has six rows with $3$ desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right.
Some places are already occupied, and some places are vacant. Petya has just entered the class and wants to occupy the most convenient place. The conveniences of the places are shown on the picture:
Here, the desks in the top row are the closest to the blackboard, while the desks in the bottom row are the furthest from the blackboard.
You are given a plan of the class, where '\*' denotes an occupied place, '.' denotes a vacant place, and the aisles are denoted by '-'.
Find any of the most convenient vacant places for Petya.
Some places are already occupied, and some places are vacant. Petya has just entered the class and wants to occupy the most convenient place. The conveniences of the places are shown on the picture:
Here, the desks in the top row are the closest to the blackboard, while the desks in the bottom row are the furthest from the blackboard.
You are given a plan of the class, where '\*' denotes an occupied place, '.' denotes a vacant place, and the aisles are denoted by '-'.
Find any of the most convenient vacant places for Petya.
输入格式
The input consists of $6$ lines. Each line describes one row of desks, starting from the closest to the blackboard. Each line is given in the following format: two characters, each is '\*' or '.' — the description of the left desk in the current row; a character '-' — the aisle; two characters, each is '\*' or '.' — the description of the center desk in the current row; a character '-' — the aisle; two characters, each is '\*' or '.' — the description of the right desk in the current row. So, the length of each of the six lines is $8$ .
It is guaranteed that there is at least one vacant place in the classroom.
It is guaranteed that there is at least one vacant place in the classroom.
输出格式
Print the plan of the classroom after Petya takes one of the most convenient for him places. Mark this place with the letter 'P'. There should be exactly one letter 'P' in the plan. Petya can only take a vacant place. In all other places the output should coincide with the input.
If there are multiple answers, print any.
If there are multiple answers, print any.
输入输出样例
输入 #1
..-**-.. ..-**-.. ..-..-.. ..-..-.. ..-..-.. ..-..-..
输出 #1
..-**-.. ..-**-.. ..-..-.. ..-P.-.. ..-..-.. ..-..-..
输入 #2
**-**-** **-**-** ..-**-.* **-**-** ..-..-.. ..-**-..
输出 #2
**-**-** **-**-** ..-**-.* **-**-** ..-P.-.. ..-**-..
输入 #3
**-**-*. *.-*.-** **-**-** **-**-** ..-..-.. ..-**-..
输出 #3
**-**-*. *.-*P-** **-**-** **-**-** ..-..-.. ..-**-..
In the first example the maximum convenience is $3$ .
In the second example the maximum convenience is $2$ .
In the third example the maximum convenience is $4$ .
In the second example the maximum convenience is $2$ .
In the third example the maximum convenience is $4$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted