Created
August 15, 2014 07:32
-
-
Save daclouds/8910b64cf3623da1af36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object sudoku extends App { | |
def check(input: Array[Int]): Boolean = { | |
Range(1, 10).toSet[Int] == input.map(_.toInt).toSet | |
} | |
def process(lineIn: Iterator[String])(lineOut: String => Unit) = { | |
var amountCases: Int = lineIn.next().toInt | |
var sizeOfSquare: Int = lineIn.next().toInt | |
for (i <- 1 to amountCases) { | |
var length = sizeOfSquare * sizeOfSquare | |
var board = Array.ofDim[Int](length, length); | |
for (j <- 0 to length - 1) { | |
var abc = lineIn.next().split(" ").map(_.toInt).toArray | |
println(abc.toSeq) | |
board +: abc | |
} | |
for (a <- board) { | |
println(a.toSeq) | |
} | |
} | |
} | |
val writer = new java.io.PrintWriter("d.large.out") | |
try { | |
process(io.Source.fromFile("input.txt").getLines)(writer.println) | |
} finally { | |
writer.flush(); writer.close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment