摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;char st[100];bool check(){ for (int i = 1; i < 4; i++) if (st[i] != st[i - 1]) return true; return false;}int main(){ //freopen("t.txt&qu 阅读全文
posted @ 2011-06-22 20:49 undefined2024 阅读(309) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 1505#define inf 0x3f3f3f3fint f[maxn];int pos[3], fac[3];int main(){ //freopen("t.txt", "r", stdin); f[1] = 1; pos[0] = pos[1] = pos[2] = 阅读全文
posted @ 2011-06-22 20:26 undefined2024 阅读(429) 评论(0) 推荐(0)
摘要: 简单题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 阅读(777) 评论(0) 推荐(0)