Skip to content

Instantly share code, notes, and snippets.

@tyama
Created November 6, 2011 01:58
Show Gist options
  • Save tyama/1342354 to your computer and use it in GitHub Desktop.
Save tyama/1342354 to your computer and use it in GitHub Desktop.
半角数字を使わない九九
def 数字 = "〇一二三四五六七八九"
def 範囲 = 数字.collect{漢数字->数字.indexOf(漢数字)}
println 範囲.collect{段->
範囲.collect{掛->
(段*掛)!=[].size()?(段*掛).toString().collect{数-> 数字[数.toInteger()]}.join()
.padLeft(数字.indexOf("二")," ")+" ":""
}.join()
}.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment