制作一个程序,该程序需要一个长度和间隔列表,并使用线条图字符为每个间隔输出具有更长刻度线的该长度的标尺 ┌ ┬ ┐ │ ╵
- 输出的第一行应以0的刻度开头,
┌
以的长度结尾的刻度结束┐
,中间的┬
每个字符都使用一个。length
第一行总共有+ 1个线条画字符。 - 刻度应使用
╵
和│
根据输入间隔在垂直方向上延长半字符。 - 相对于之前的间隔,间隔从最小到最大列出。详细说明:
- 第一个间隔告诉第二个最小间隔(最小间隔为1)中有多少个基本刻度(第一行-每个刻度一个字符)。例如,[3]将每三个刻度延长半个字符。
- 第二个间隔和后续间隔是下一个最小间隔。例如,[3,5]将每15个基本刻度增加一个完整字符,[3,5,2]将每30个基本刻度增加一个字符半。
- 子间隔为1是有效的,并且有效地表示最后一个间隔行以完整字符而不是半字符延长。
- 示例测试用例应有助于阐明其工作原理。
示例/测试用例
3,[]:
┌┬┬┐
9,[3]:
┌┬┬┬┬┬┬┬┬┐
╵ ╵ ╵ ╵
30,[5,2]:
┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
│ ╵ │ ╵ │ ╵ │
32,[4,2,2,2]:
┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
│ ╵ │ ╵ │ ╵ │ ╵ │
│ ╵ │
48,[5,3,2]
┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
│ ╵ ╵ │ ╵ ╵ │ ╵ ╵ │
╵ ╵
24,[7,3]
┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
│ ╵ ╵ │
17,[3,2,1]
┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
│ ╵ │ ╵ │ ╵
╵ ╵ ╵
1,[23,19,13,11,11,7,5,3,2,1]
┌┐
│
│
│
│
╵
其他规则/说明
- 输入和输出可以使用任何方便的格式
- 标尺不必在大刻度上结束
- 间隔列表可能为空
- 第零刻度始终在所有间隔内。
- 您可以假设标尺的长度和间隔始终为小于120的正整数
- 尾随空格可以,但前导空格则不能。
- 如果出于某种原因要使用ASCII空格以外的其他字符,则允许使用任何固定的单宽空格作为空格字符。
高尔夫快乐!