230A A. Dragons贪心水题View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;struct node{ int x, y;}p[1003];bool cmp(node a, node b){ return a.x < b.x || a.x == b.x && a.y > b.y;}int main(){ int i, j; int n, s; while( ~scanf("%d%d", Read More
posted @ 2012-10-05 21:56
To be an ACMan
Views(371)
Comments(0)
Diggs(0)
哈哈View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxn 300003int vis[maxn];struct node{ int sex, fa, de, DNA; // sex性别,fa父亲节点, de是不是死了;}p[maxn];int a[maxn];int n, m, k;int find(int x){ return p[x].fa == x ? x : p[x].fa = find(p[x].fa);}vo Read More
posted @ 2012-10-05 20:45
To be an ACMan
Views(268)
Comments(0)
Diggs(0)
树形DP, 2 个dfs。前几天觉得很难,现在可以说是水题了。View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxn 10003struct E{ int v, next, w;}edge[maxn<<1];int tot, head[maxn];int n, m;void init(){ tot = 0; memset(head, -1, sizeof(int)*(n+1));}void add(int s, Read More
posted @ 2012-10-05 18:54
To be an ACMan
Views(282)
Comments(0)
Diggs(0)
4001 模拟题,仔细一点可以1A。我的代码有点长,但思路很清楚。View Code #include<stdio.h>#include<string.h>bool vis[11][11];int dir[4][2] = {1, 0, -1, 0, 0, -1, 0, 1};int d[8][2] = {2, 1, 2, -1, -2, 1, -2, -1, 1, 2, 1, -2, -1, 2, -1, -2};int dd[8][2] = {1, 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, -1};int main(){ Read More
posted @ 2012-10-05 18:37
To be an ACMan
Views(278)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号