// move         len   move’   len'           temp       final move 
// 4 * 1 4=4-0   1=2*0+1 => 0=(len-1)/2 => move=4-(len-1)/2
// 3 *** 3 3=4-1 3=2*1+1
// 2 ***** 5 2=4-2
// 1 ******* 7 1=4-3
// 0 ********* 9 0=4-4

1.Vector(1,3,5,7,9)
2.Vector(*,***,*****,*******,*********)
3.推导空白move和len的关系公式
4.foreach实现

(1 to(9, 2)).map("*"*_).foreach(x=>println(" " * (4-(x.length-1)/2)+x))
 

 
                    
            
                

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-01-11
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-30
  • 2021-09-02
  • 2022-12-23
  • 2021-12-21
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案