tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
1
Task/Pascals-triangle/Groovy/pascals-triangle-1.groovy
Normal file
1
Task/Pascals-triangle/Groovy/pascals-triangle-1.groovy
Normal file
|
|
@ -0,0 +1 @@
|
|||
def pascal = { n -> (n <= 1) ? [1] : GroovyCollections.transpose([[0] + pascal(n - 1), pascal(n - 1) + [0]]).collect { it.sum() } }
|
||||
4
Task/Pascals-triangle/Groovy/pascals-triangle-2.groovy
Normal file
4
Task/Pascals-triangle/Groovy/pascals-triangle-2.groovy
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def count = 15
|
||||
(1..count).each { n ->
|
||||
printf ("%2d:", n); (0..(count-n)).each { print " " }; pascal(n).each{ printf("%6d ", it) }; println ""
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue