摘要: 动态struct node{ int u,v,w; node *next;}*first[N];//一个节点相连的所有节点 构成一条链void init(){ memset(first,NULL,sizeof(first));}void add(int u,int v,int w){ node *p = new node; p->v = v; p->w = w; p->next = first[u];//类似于正序链表的插入 first[u] = p;}for(node *p = first[u] ; p!=NULL ; p= p->next){... 阅读全文
posted @ 2012-08-01 21:54 _雨 阅读(200) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1253View Code 1 #include<stdio.h> 2 #include<string.h> 3 int a[51][51][51]; 4 struct node 5 { 6 int x,y,z,num; 7 }q[50001]; 8 int p,d,f[51][51][51]; 9 int an[6][3] = {{0,0,1},{0,0,-1},{0,1,0},{0,-1,0},{1,0,0},{-1,0,0}};10 int main()11 {12 int i,j 阅读全文
posted @ 2012-08-01 17:32 _雨 阅读(136) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1372搜索8个可到达的点View Code 1 #include <stdio.h> 2 #include<string.h> 3 struct node 4 { 5 int tx,ty,num; 6 }q[100001]; 7 int u[8][2]={{-2,-1},{-2,1},{-1,-2},{-1,2},{1,-2},{1,2},{2,-1},{2,1}}; 8 int main() 9 {10 int i,j,k,n,m,w,x[2],y[2],d,p,f[50][50]; 阅读全文
posted @ 2012-08-01 10:28 _雨 阅读(139) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4325多校联合3上的题 对线段树还不是太了解 只知道这道题是线段树 打的代码那叫一个纠结啊 。。交上还TLE昨天晚上仔细想了想 明白是怎么回事了 就是建一个线段树 找到指定的区间加1 询问的时候 看在哪些区间里 把这些区间都加起来w定义的int类型的 一直出错 后来一想 存不了 改了就对了View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define N 100001 4 __int64 s[4*N],re; 5 void bu 阅读全文
posted @ 2012-08-01 09:37 _雨 阅读(188) 评论(0) 推荐(0) 编辑