make( j % 5 + 1 , ( j + 1 ) % 5 + 1 , ( j + 2 ) % 5 + 1 , ( j + 3 ) % 5 + 1 , ( j + 4 ) % 5 + 1 ,
i % 25 , ( i + 5 ) % 25 , ( i + 10 ) % 25 , ( i + 15 ) % 25 , ( i + 20 ) % 25 )
}
xs.foreach ( ys => println( ys.map ( y => f"$y%3d" ) .mkString ) )
println
}
def make
( a
: Int, b
: Int, c
: Int, d
: Int, e
: Int, f
: Int, g
: Int, h
: Int, i
: Int, j
: Int
) = { val pat1
= List
( List
( a, b, c, d, e
) , List
( c, d, e, a, b
) , List
( e, a, b, c, d
) , List
( b, c, d, e, a
) , List
( d, e, a, b, c
) ) val pat2
= List
( List
( f, g, h, i, j
) , List
( i, j, f, g, h
) , List
( g, h, i, j, f
) , List
( j, f, g, h, i
) , List
( h, i, j, f, g
) ) ( pat1 zip pat2) .map ( xs => xs._ 1 zip xs._ 2) .map ( xs => xs.map ( xx => xx._ 1 + xx._ 2) )
}
}
cGFja2FnZSBwcmFjdGljZQoKb2JqZWN0IE1hZ2ljU3F1YXJlIGV4dGVuZHMgQXBwIHsKCiAgdmFsIHJlcyA9IGZvciAoaiA8LSAxIHRvIDU7IGkgPC0gMCB0byAyMCBieSA1KSB5aWVsZCB7CiAgICBtYWtlKGogJSA1ICsgMSwgKGogKyAxKSAlIDUgKyAxLCAoaiArIDIpICUgNSArIDEsIChqICsgMykgJSA1ICsgMSwgKGogKyA0KSAlIDUgKyAxLAogICAgICBpICUgMjUsIChpICsgNSkgJSAyNSwgKGkgKyAxMCkgJSAyNSwgKGkgKyAxNSkgJSAyNSwgKGkgKyAyMCkgJSAyNSkKICB9CgogIGZvciAoeHMgPC0gcmVzKSB7CiAgICB4cy5mb3JlYWNoKHlzID0+IHByaW50bG4oeXMubWFwKHkgPT4gZiIkeSUzZCIpLm1rU3RyaW5nKSkKICAgIHByaW50bG4KICB9CgogIGRlZiBtYWtlKGE6IEludCwgYjogSW50LCBjOiBJbnQsIGQ6IEludCwgZTog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