摘要: 题意:数独问题这个题思路很好想,但是在判断3*3小区域的时候出现了错误。写的时候还是稳一些吧,要不然调的时候会吐血的。代码:View Code 1 #include <iostream> 2 #include <stdio.h> 3 #include <memory.h> 4 using namespace std; 5 6 const int maxnum=10; 7 int array[maxnum][maxnum]; 8 bool flag; 9 int cur; 10 struct pos 11 { 12 int x; 13 int y; 14 }. 阅读全文
posted @ 2012-07-29 08:30 pushing my way 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题意:染色问题,图中之间有边的两个区域不能染成相同的颜色。求将图中每个区域全部染色后需要最少的颜色。分析:参考染色定理得,无论图中有多少区域,最多需要4个区域。因此遍历这四种情况即可.代码:View Code 1 #include <iostream> 2 #include <stdio.h> 3 #include <memory.h> 4 using namespace std; 5 6 const int maxnum=27; 7 bool array[maxnum][maxnum]; 8 int num; 9 10 void fuction()11 { 阅读全文
posted @ 2012-07-29 08:28 pushing my way 阅读(1290) 评论(0) 推荐(0) 编辑