First, have a look at the problem at http://online-judge.uva.es/p/v7/706.html

Here is my first attempt at the solution:

dl=:<@}.;._1 (0 : 0)
~
-
| |

| |
-
~

 |

 |

~
-
 |
-
|
-
~
-
 |
-
 |
-
~

| |
-
 |

~
-
|
-
 |
-
~
-
|
-
| |
-
~
-
 |

 |

~
-
| |
-
| |
-
~
-
| |
-
 |
-
)
ss=:[: > <;._2
sep=:10&#.^:_1
sdl=: ss each dl
hm=:] #"1~ 1 , 1 ,~ [
vb=:[: >: (5$0 1) * <:
vm=:(#~ vb)~
mm=: [ hm vm
con=:[ ,. ' ' ,. ]
ds=: sdl {~ sep
lcd=: [:>con&.>/@(mm&.> ds)
2 lcd 12345

I wonder if mine is J-ish or not, and how you would solve this problem
in more J-ish way(if any). I am excited to learn from your solutions!

p.s. I happened upon rubyists solution at
http://rubyquiz.com/quiz14.html   Have a look at it for comparison.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to