索罗班由一定数量的杆组成,每根杆包含五个珠子。我们将假设杆是水平线。每根杆上的一个珠子(最左边的那个)与其他珠子由一个条形(推算条)隔开。这个珠子叫做go-dama,另外四个是ichi-damas。每根杆负责表示从 0 到 9 的一位数字。我们可以通过以下简单的算法获得数字的值:
将数字的值设置为 0。
如果 go-dama 向右移动,则添加 5。
加上向左移动的一畑数量。
因此,图片上的上杆显示数字 0,中间的杆显示数字 2,下面的杆显示数字 7。我们将考虑顶部杆表示数字的最后一个十进制数字,因此图片显示数字 720。
编写程序,以 Soroban 显示给定数字 n 的方式打印。
You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban − an abacus developed in Japan. This phenomenon has its reasons, of course, but we are not going to speak about them. Let's have a look at the Soroban's construction.
2
O-|OO-OO
13
O-|OOO-O O-|O-OOO
720
O-|-OOOO O-|OO-OO -O|OO-OO
第一行包含单个整数 n (0≤n<10^9)。
输入1:
2
输出1:
O-|OO-OO
输入2:
13
输出2:
O-|OOO-O
O-|O-OOO
输入3:
720
输出3:
O-|-OOOO
O-|OO-OO
-O|OO-OO
2
O-|OO-OO