University stuff.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import java.io.File;
  2. import java.io.OutputStream;
  3. import java.io.FileOutputStream;
  4. class Sudoku {
  5. public static void main(String[] args) throws Exception {
  6. if (args.length < 1) {
  7. System.out.println("Usage: java Sudoku <input> [output]");
  8. return;
  9. }
  10. File in = new File(args[0]);
  11. OutputStream out;
  12. if (args.length > 1) {
  13. File f = new File(args[1]);
  14. f.createNewFile();
  15. out = new FileOutputStream(f);
  16. System.out.println(args[1]);
  17. } else {
  18. out = System.out;
  19. }
  20. Brett b = new Brett(in);
  21. b.print();
  22. SudokuBeholder sb = b.los();
  23. System.out.println("");
  24. System.out.println("Fant "+sb.hentAntallLosninger()+" losninger.");
  25. if (args.length > 1) {
  26. System.out.println("Skriver til filen "+args[1]);
  27. }
  28. for (SudokuBeholder.Losning l: sb) {
  29. sb.print(out, l);
  30. out.write("\n".getBytes());
  31. }
  32. out.flush();
  33. }
  34. }