摘要:
#include #include #include int fenzu[6][6];int used_fenzu[6][6];//根据分组信息确定第一位;根据字母排列A B C D E F确定第二位;最终依靠本数组实现"组内判重"int used_row[6][6];//第一位为行数int used_col[6][6];//第一位为列数char map[6][6];int next_row[40];int next_col[40];int all = 1;void print(){ int i, j; for(i = 0; i < 6; i++){for(j = 0 阅读全文
posted @ 2013-07-04 22:59
wwjyt
阅读(195)
评论(0)
推荐(0)
摘要:
1.long long 使用 %lld读&写2.两行并行的DP(两行之中每一个状态的状态转移方向不同[虽然类似]),所以要写两个转移函数3.需要注意的代码:int f1(int index){ if(dp1[index] != INF) return dp1[index] ; if(index == 1)//不要想当然的把结尾当作0 return dp1[index] = time1[0] + time1[1];//结尾处不仅要加time1[0],也要加time1[1] else return dp1[index] = min( f1(index-... 阅读全文
posted @ 2013-07-04 16:38
wwjyt
阅读(218)
评论(0)
推荐(0)
摘要:
第一类 动态规划 (至少6题,2479 and 2593必做)2479 and 2593 1015 1042 (也可贪心) 1141 1050 1080 1221 1260 2411 (稍难) 1276第二类 搜索 (至少4题)1011 1033 1129 2049 2056 2488 2492 (稍难,也可并查集)第三类 贪心 (至少2题)1065 2054 (难) 1521 2709第四类 最短路 (至少3题)1062 1125 1797 2253 2679 Bellman-Ford (难)第五类 最小生成树 (至少2题, 而且 Prim 和 Kruskal 至少各用一次)1251 125 阅读全文
posted @ 2013-07-04 15:04
wwjyt
阅读(160)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2013-07-04 14:25
wwjyt
阅读(108)
评论(0)
推荐(0)
摘要:
可直接看出:4行 5列 起点到终点步数为7(从0开始)转化:转为只能往 → 与 ↓ 走的DFS易错:dfs到下一个点,注意是判断 r+1 #define ROW 5#define COL 4int count = 0;void dfs(int r, int c, int n){ if(n == 7) { count++; return; } if(r+1 < ROW) dfs(r+1, c, n+1); if(c+1 < COL) dfs(r, c+1, n+1); }int main(... 阅读全文
posted @ 2013-07-04 12:19
wwjyt
阅读(178)
评论(0)
推荐(0)
浙公网安备 33010602011771号