FilesSubmittedBranchesLabelsClientsUsersJobsHelp
Tree viewShow file textShow revision historyShow/hide recent activityInformation
//depot/projects/sudoku/fast/sudoku.c

Diffs between #3 and #4

@@ -12,6 +12,7 @@
1212#include <stdio.h>
1313#include <stdlib.h>
1414#include <string.h>
15#include <time.h>
1516
1617static int grid[9][9];
1718static long nodes = 0;
@@ -99,6 +100,7 @@
99100{
100101 FILE *f = stdin;
101102 int i;
103 clock_t t0;
102104
103105 if (argc > 1 && !(f = fopen(argv[1], "r"))) {
104106 perror(argv[1]);
@@ -112,11 +114,13 @@
112114 if (grid[i / 9][i % 9])
113115 place(i / 9, i % 9, grid[i / 9][i % 9]);
114116 }
117 t0 = clock();
115118 if (!solve(0)) {
116119 printf("no solution (are you sure you copied it right?)\n");
117120 return 1;
118121 }
119122 print_grid();
120 fprintf(stderr, "%ld nodes\n", nodes);
123 fprintf(stderr, "%ld nodes, %.3fs\n", nodes,
124 (double)(clock() - t0) / CLOCKS_PER_SEC);
121125 return 0;
122126}

P4Web/LINUX26X86/2005.1/82295 · Copyright © 1995-2005 Perforce Software · ttul.org