这道题简直是耻辱啊,居然被吓得不敢做,终于开始写还犯下了各种低级错误,花了好久的时间。
其实如果想明白81*9其实是很小的规模的话,早就想到用回溯法了,这不是跟八皇后完全一样的嘛。每次填入的时候,验证一下合不合理,其中合不合理在上一个问题中已经讨论过了,对当前位置讨论更简单。
所的头头是道,你会问“那你是错在哪呢?”你猜啊。我在判断一个小方格时候合理时,走了很多弯路。一开始想的是用循环和减法,...
分类:
其他好文 时间:
2014-05-15 14:37:04
阅读次数:
203
犯了很多细节上的错误,比如忽视了“-”的存在,正是因为有“-”的存在,所以不能用if
(rows.size() == i)来判断rows里面是否已经存某一行,如果不存在再row = new
ArrayList();row.add(board[i][j]);rows.add(row);来添加新的一行。...
分类:
其他好文 时间:
2014-05-10 09:06:35
阅读次数:
341
Sudoku
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 13023
Accepted: 6455
Special Judge
Description
Sudoku is a very simple task. A square table with 9...
分类:
其他好文 时间:
2014-05-03 00:31:30
阅读次数:
400
Sudoku
Time Limit: 10000MS
Memory Limit: 65536K
Total Submissions: 4203
Accepted: 2051
Description
A Sudoku grid is a 16x16 grid of cells grouped in sixteen 4x4 squares...
分类:
其他好文 时间:
2014-05-02 23:15:40
阅读次数:
605
Sudoku
Time Limit: 50000/20000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)
Total Submission(s): 501 Accepted Submission(s): 208
Problem Description
AmazingCaddy likes Sud...
分类:
其他好文 时间:
2014-05-02 21:31:40
阅读次数:
282
数独问题,输入谜题,输出解既然都把重复覆盖的给写成模板了,就顺便把精确覆盖的模板也写好看点吧。。。赤裸裸的精确覆盖啊~~~水一水~~~然后继续去搞有点难度的题了。。。
1 #include 2 #include 3 #include 4 #include 5 #include ...
分类:
其他好文 时间:
2014-05-02 00:41:40
阅读次数:
286
The well-armed problem-finder/solver is fluent
in many mental languages and is able to use them interchangeably to record
information, communicate wit...
分类:
其他好文 时间:
2014-05-01 20:13:44
阅读次数:
433
判断valid,没有更好的方法,只能brute force。 1 class Solution { 2
public: 3 bool isValidSudoku(vector > &board) { 4 5 int n; 6 for (int...
分类:
其他好文 时间:
2014-05-01 08:54:28
阅读次数:
332
Cultural blocks1) TaboosPing-pong ball
exerciseTaboos can remove entire families of solutions from the ready grasp of
the problem-solver. This is not ...
分类:
其他好文 时间:
2014-04-30 18:17:21
阅读次数:
462
Page 30Perceptual blocks are obstacles that
prevent the problem-solver from clearly perceiving either the problem itself or
the information needed to ...
分类:
其他好文 时间:
2014-04-28 00:54:37
阅读次数:
403