摘要:
dpView Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 105#define inf 0x3f3f3f3fint map[maxn][maxn];int income[maxn][maxn];int n, m;int f[maxn][maxn];void input(){ for (int i = 0; i < n; i++) for (int j = 0; j & 阅读全文
posted @ 2011-10-09 17:09
undefined2024
阅读(162)
评论(0)
推荐(0)
摘要:
简单题, BFSView Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 105struct Point{ int x, y; Point() { } Point(int xx, int yy): x(xx), y(yy) { }}q[maxn * maxn];int n;int map[maxn][maxn];bool vis[maxn][maxn];int dir[4][2 阅读全文
posted @ 2011-10-09 13:43
undefined2024
阅读(177)
评论(0)
推荐(0)
摘要:
记忆化搜索View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int f[] = {1, 0, 6, 12, 90, 360, 2040, 10080, 54810, 290640, 1588356, 8676360, 47977776, 266378112, 1488801600};int n;int main(){ //freopen("t.txt", "r&qu 阅读全文
posted @ 2011-10-09 13:08
undefined2024
阅读(330)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int n;long long gcd(long long x, long long y){ if (!x || !y) return x > y ? x : y; for (long long t; t = x % y; x = y, y = t); return y;}void input(){ long long ans = 1 阅读全文
posted @ 2011-10-09 12:17
undefined2024
阅读(185)
评论(0)
推荐(0)
摘要:
简单排序,但是由于读入量过大,要用getchar()按位读入数字。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;#define maxn 1000005int n;int f[maxn];int in(){ char ch = '0'; int ret = 0; while (ch <= '9' &am 阅读全文
posted @ 2011-10-09 10:53
undefined2024
阅读(225)
评论(0)
推荐(0)