Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
def make2d = { nrows, ncols ->
|
||||
(0..<nrows).collect { [0]*ncols }
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
def r = new Random()
|
||||
|
||||
System.in.splitEachLine(/,\s*/) { dim ->
|
||||
def nrows = dim[0] as int
|
||||
def ncols = dim[1] as int
|
||||
|
||||
def a2d = make2d(nrows, ncols)
|
||||
|
||||
def row = r.nextInt(nrows)
|
||||
def col = r.nextInt(ncols)
|
||||
def val = r.nextInt(nrows*ncols)
|
||||
|
||||
a2d[row][col] = val
|
||||
|
||||
println "a2d[${row}][${col}] == ${a2d[row][col]}"
|
||||
|
||||
a2d.each { println it }
|
||||
println()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue