39 lines
903 B
Java
39 lines
903 B
Java
|
import java.io.File;
|
||
|
import java.io.FileReader;
|
||
|
import java.io.FileNotFoundException;
|
||
|
import java.util.Scanner;
|
||
|
|
||
|
|
||
|
class Main {
|
||
|
public static void main(String[] args) {
|
||
|
int N_SUDOKUS = 50;
|
||
|
|
||
|
Sudoku[] sudokus = new Sudoku[N_SUDOKUS];
|
||
|
|
||
|
try {
|
||
|
File f = new File("../txt/e096.txt");
|
||
|
Scanner s = new Scanner(f);
|
||
|
for (int i = 0; i < N_SUDOKUS; i++) {
|
||
|
sudokus[i] = new Sudoku();
|
||
|
sudokus[i].loadFieldFromScanner(s);
|
||
|
}
|
||
|
s.close();
|
||
|
} catch (FileNotFoundException e) {
|
||
|
System.out.println("An error occurred.");
|
||
|
e.printStackTrace();
|
||
|
} catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
|
||
|
int s = 0;
|
||
|
for (int i = 0; i < N_SUDOKUS; i++) {
|
||
|
// sudokus[i].printField();
|
||
|
sudokus[i].solveSudoku();
|
||
|
s += sudokus[i].getThreeDigits();
|
||
|
// sudokus[i].printField();
|
||
|
}
|
||
|
System.out.println("e096: " + s);
|
||
|
}
|
||
|
}
|
||
|
|