A1379 | [COCI-2020-2021-contest2]#1 Crtanje
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Josip used to code in Logo. He loved to draw pictures, but those days are sadly over. Nostalgic, he decided to draw a line that represents the net worth of his company over a period of n days.
For each of the n days, he knows if the net worth of his company increased by one unit (represented by ’+’), decreased by one unit (represented by ’-’), or remained the same (represented by ’=’) during that day. Before the first day, the net worth was equal to zero.
Josip will draw the line in a big infinite matrix of characters. Indices of matrix rows grow upwards, and indices of columns grow to the right. For the i-th day he will draw some character in the i-th column.
The character and the index of the row are decided by the following rules:
• If the net worth increased during the i-th day, he will draw ’/’ in the row with index equal to the net worth at the beginning of the day.
• If the net worth decreased during the i-th day, he will draw ’\’ in the row with index equal to the net worth at the end of the day.
• If the net worth didn’t change during the i-th day, he will draw ’_’ in the row with index equal to the net worth during the day.
All other cells are filled with ’.’.
Your task is to output the minimal matrix that contains the whole line, i.e. contains all characters ’/’, ’\’ and ’_’ that Josip drew.
For each of the n days, he knows if the net worth of his company increased by one unit (represented by ’+’), decreased by one unit (represented by ’-’), or remained the same (represented by ’=’) during that day. Before the first day, the net worth was equal to zero.
Josip will draw the line in a big infinite matrix of characters. Indices of matrix rows grow upwards, and indices of columns grow to the right. For the i-th day he will draw some character in the i-th column.
The character and the index of the row are decided by the following rules:
• If the net worth increased during the i-th day, he will draw ’/’ in the row with index equal to the net worth at the beginning of the day.
• If the net worth decreased during the i-th day, he will draw ’\’ in the row with index equal to the net worth at the end of the day.
• If the net worth didn’t change during the i-th day, he will draw ’_’ in the row with index equal to the net worth during the day.
All other cells are filled with ’.’.
Your task is to output the minimal matrix that contains the whole line, i.e. contains all characters ’/’, ’\’ and ’_’ that Josip drew.
输入格式
The first line contains an integer n (1 ≤ n ≤ 100), the number of days.
The second line contains a string of n characters ’+’, ’-’ and ’=’ that represents how the company’s net worth changed over the given period.
The second line contains a string of n characters ’+’, ’-’ and ’=’ that represents how the company’s net worth changed over the given period.
输出格式
Output the described matrix.
输入输出样例
输入 #1
7 ++---==
输出 #1
./\.... /..\... ....\__
输入 #2
5 +=+=+
输出 #2
..._/ ._/.. /....
In test cases worth 20 points the input won’t contain the character ’-’.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted