上一页 1 ··· 124 125 126 127 128 129 130 131 132 ··· 182 下一页
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxl 20char p[maxl], q[maxl], r[maxl];long long cal(char *st, int base){ long long x = 1, ret = 0; for (int i = strlen(st) - 1; i >= 0; i--) { ret += x * (st[i] 阅读全文
posted @ 2011-06-22 20:12 undefined2024 阅读(174) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 10005bool vis[maxn];int father[maxn];int main(){ //freopen("t.txt", "r", stdin); int t; scanf("%d", &t); while (t--) { memse 阅读全文
posted @ 2011-06-22 19:23 undefined2024 阅读(1001) 评论(1) 推荐(0)
摘要: 最小点集覆盖匈牙利算法View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 105int n, uN, vN;bool g[maxn][maxn];int xM[maxn], yM[maxn];bool chk[maxn];bool SearchPath(int u){ int v; for (v = 0; v < vN; v++) if (g[u][v] & 阅读全文
posted @ 2011-06-22 19:06 undefined2024 阅读(227) 评论(0) 推荐(0)
摘要: 题意:给出一个贪吃蛇地图,以及贪吃蛇现在身体各个块所在的位置,求它的头走到(1,1)位置最少需要多少步。分析:搜索题,用vis[20][20][16384]判重,第三维表示蛇的形状,用位操作,每两位表示一个方向(00,01,10,11表示四个方向)。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <queue>usingnamespace std;#define maxn 21#define maxl 阅读全文
posted @ 2011-06-22 18:38 undefined2024 阅读(776) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 10bool row[maxn], col[maxn];bool map[maxn][maxn];int ans, n, m;void input(){ char ch; memset(map, 0, sizeof(map)); getchar(); for (int i = 0; i < n; i++) { 阅读全文
posted @ 2011-06-21 21:31 undefined2024 阅读(316) 评论(0) 推荐(0)
上一页 1 ··· 124 125 126 127 128 129 130 131 132 ··· 182 下一页