上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 99 下一页

2011年8月11日

连连看 hdu 1175

摘要: 这题刚开始时一直TLE,后来改了之后,一直wa,,重写一遍就过了。。至今不知道原来错在哪里。。郁闷啊。。#include <stdio.h>#include <stdlib.h>#include <string.h>#include <queue>using namespace std;int N, M, T, x1, x2, y1, y2;int map[1010][1010];int mark[1010][1010];const int inf = 0x7f7f7f7f;void debug( ){ #ifdef P freopen(&quo 阅读全文

posted @ 2011-08-11 17:00 more think, more gains 阅读(150) 评论(0) 推荐(0) 编辑

递归 生成全排列

摘要: #include <stdio.h>#include <string.h>int a[20], N;void fun(int n, int r){ int i, j, flag; if( r == n) { for(i = 0; i < n; i++) printf("%d ",a[i]); puts(""); return ; } else { for (i = 1; i <= n; i++) { flag = 1; for(j = 0; j < r; j++) if ( i == a[j] ) flag = 阅读全文

posted @ 2011-08-11 16:58 more think, more gains 阅读(142) 评论(0) 推荐(0) 编辑

2011年8月9日

Nightmare hdu 1072

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <algorithm>using namespace std;int T, N, M, a, b, c, d, f1;int map[10][10];int xx[ ]= {0, 1, -1, 0};int yy[ ]= {1, 0, 0, -1};int hash[10][10];struct node{ int x, y, t, n; /*bool operator &l 阅读全文

posted @ 2011-08-09 20:19 more think, more gains 阅读(136) 评论(0) 推荐(0) 编辑

Asteroids! hdu 1240

摘要: 三维空间的简单BFS....#include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <iostream>using namespace std;char map[20][20][20];int N, a, b, c, d, e, f, f1;int xx[ ] = {0, 1, 0, -1, 0, 0};int yy[ ] = {1, 0, -1, 0, 0, 0};int zz[ ] = {0, 0, 0, 0 , 1, -1} 阅读全文

posted @ 2011-08-09 18:14 more think, more gains 阅读(150) 评论(0) 推荐(0) 编辑

Knight Moves BFS 水题

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <algorithm>using namespace std;int xx[ ] = {1,2,-1,-2,-2,-1,1,2};int yy[ ] = {2,1,-2,-1,1,2,-2,-1};int map[10][10];int a, b, c, d, f1 = 0;int judge( int x, int y){ if ( x < 1 || x > 8 阅读全文

posted @ 2011-08-09 17:10 more think, more gains 阅读(196) 评论(0) 推荐(0) 编辑

上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 99 下一页

导航