给定十进制形式的<float>, <precision>
,您将绘制浮点数小数部分(即小数)的图形表示。例子:
输入:
6.75, 4
,输出:6||| 7 ----
6.75
(输入中的第一个数字)是要解释的数字,4
(输入中的第二个数字)是管道下方的破折号。6
是7
底数6.75,是天花板6.75
。管道数是decimal part of first input number * second input number
。输入:
10.5, 6
,输出:10||| 11 ------
输入:
20.16, 12
,输出20|| 21 ------------
.16
实际需要1.92根管,但是由于我无法绘制1.92根管,因此我将其最高拉至2。输入:
1.1, 12
,输出:1| 2 ------------
.1
在这种情况下为1.2根管道,因此将其设置为1根管道。此外,边缘情况。输入:(
5, 4
即数字为整数),输出:5 6 ----
- 要说明的数字是正浮点数,仅受您的语言能力的限制。
- 精度数是一个偶数整数,大于2(即,最低要求精度为4)。也可以任意大。
- > =将n.5个管道四舍五入到n + 1(即1.5被四舍五入为2,2.5被四舍五入为3)。<n.5个管道四舍五入为n(即1.4 近似为1,2.4近似为2)。
- 如果您的语言更方便,则可以将输入作为数组,例如
[6.75, 4]
。如果您以相反的顺序(即)接受输入[4, 6.75]
,请在您的答案中进行指定。
5.0 4
:输入是从5
到6
还是从4
到5
,还是可以接受的?输入1.25 2
:它有0或1 |
s,为什么?(即四舍五入规则是什么)?输入的第一个数字必须为正吗?它的最大精度和大小是多少?输入中的第二个数字是否必须为正数?如果为负,我们是否会倒退?