上一页 1 ··· 4 5 6 7 8 9 下一页
2011年3月26日

hdu 1312 ( Red and Black )

摘要: /*依旧献给刻苦学习的班长同学!!~这题和勘探油田本质上是一样的,求给定的一个点的连通区域的格子数下面是非递归写法*/Problem : 1312 ( Red and Black ) Judge Status : AcceptedRunId : 3709667Language : C++Author : zjut11018Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta#include<iostream>#include<cstring>#include<queue> 阅读全文
posted @ 2011-03-26 12:24 4.5.6 阅读(230) 评论(0) 推荐(0) 编辑

hdu 1241 Oil Deposits

摘要: 非递归# include<iostream># include<string>using namespace std;string map[100];int mark[100][100];struct oil{ int x; int y;};int dir[8][2]={0,-1,0,1,-1,0,1,0,1,1,1,-1,-1,1,-1,-1};oil arr[10000];int main(){int m,n;int x,y,a,b; while(cin>>m>>n&&m) { for(int k=0;k<m;k++) 阅读全文
posted @ 2011-03-26 10:54 4.5.6 阅读(304) 评论(0) 推荐(0) 编辑
2011年3月25日

hdu 1240 ( Asteroids! )

摘要: View Code Problem : 1240 ( Asteroids! ) Judge Status : Accepted又是一道常规BFS#include<iostream>#include<string>#include<queue>using namespace std;string map[10][10],ss,end;int vis[10][10][10],dir[6][3]={{1,0,0},{-1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0,-1}};int n,ok,ans;struct node{ int x 阅读全文
posted @ 2011-03-25 18:01 4.5.6 阅读(213) 评论(0) 推荐(0) 编辑
2011年3月24日

hdu 1429 ( 胜利大逃亡(续) )

摘要: View Code http://acm.hdu.edu.cn/showproblem.php?pid=1429 1 Problem : 1429 ( 胜利大逃亡(续) ) Judge Status : Accepted 2 状态压缩+BFS 3 用二进制表示第i把钥匙的有无 比如已有第三把和第一把钥匙,则二进制表示为0000000101即整数5,用|添加钥匙 (如67行),用&判断有无某把钥匙(如53行) 4 #include<iostream> 5 #include<stdio.h> 6 #include<string> 7 #include&l 阅读全文
posted @ 2011-03-24 16:24 4.5.6 阅读(360) 评论(0) 推荐(0) 编辑
2011年3月23日

hdu 1253 ( 胜利大逃亡 )

摘要: http://acm.hdu.edu.cn/problemclass.php?id=268View Code Problem : 1253 ( 胜利大逃亡 ) Judge Status : Accepted自我感觉BFS难度1可以告一段落了。思路:这题和一般的BFS的做法是一样的m[k][i][j]=1表示第k块第i行第j列是墙,#include<iostream>#include<stdio.h>#include<queue>#include<algorithm>using namespace std;int m[51][51][51],vis 阅读全文
posted @ 2011-03-23 21:23 4.5.6 阅读(343) 评论(0) 推荐(0) 编辑

hdu 1242 ( Rescue )

摘要: Problem : 1242 ( Rescue ) Judge Status : Accepted思路:优先队列+BFS#include<iostream>#include<queue>#include<string>using namespace std;int n,m,ans;string a[200];int vis[200][200],ok;int dir[4][2]={-1,0,0,1,1,0,0,-1};struct node{ int x,y,dis; node(int _x=0,int _y=0,int _dis=0):x(_x),y(_y) 阅读全文
posted @ 2011-03-23 17:12 4.5.6 阅读(286) 评论(0) 推荐(0) 编辑
2011年3月21日

许多事

摘要: 大一第一次春游比预想的要开心,所有活动都要比预想的令人淡定。通天河里摇摆的小船被所谓某某亚洲第一的机器升到传说很高的高度,结果淡定地荡下来了,连水花都没溅起。这让胆小的本人很是欣慰。篝火晚会那个女生一块钱,男生五角钱的游戏也令人满意,接着是双扣&第一次让我体验到乐趣的杀人游戏。只是晚上的住宿条件真是有点忒。。。不过还好第二日精力充沛。烧烤很不错,很享受那种忙碌的烧烤过程及偷别人的劳动成果。我想说,我们确实更偏向于肉食动物。漂流的乐趣真的来自于我们自己,两只船的追逐和让人崩溃的水战还有给力的掌船大叔。。。其实在春游出发前的一个小时发生了更令我激动地事,老师宣布了今年参加省赛的名单,我也在 阅读全文
posted @ 2011-03-21 00:21 4.5.6 阅读(182) 评论(0) 推荐(0) 编辑
2011年3月20日

1198 ( Farm Irrigation )

摘要: Problem : 1198 ( Farm Irrigation ) Judge Status : Accepted其实这道题勘探油田的变形,只是判断两个格子是否连通的规则有所变化。原先我用了一个三维数组G[i][j][k]=1来表示当图j在图i的k反向时两图连通,可是这样表示很麻烦要11幅图与11幅图一一进行对比而且容易出错,后来改用了下面check里的方法,简化了很多。G[i][k]表示第i幅图有水管的走向为k方向,如果与它相邻的G[j][(k+2)%4]=1,则两图连通#include<iostream>#include<string>#include<al 阅读全文
posted @ 2011-03-20 23:54 4.5.6 阅读(225) 评论(0) 推荐(0) 编辑
2011年3月18日

zjut 小X的苹果

摘要: http://acm.zjut.edu.cn/ShowContestProblem.aspx?ShowID=优先队列&MID=528View Code 1 #include<iostream> 2 #include<stdio.h> 3 #include<string> 4 #include<queue> 5 using namespace std; 6 int main() 7 { 8 int cas,n,a,q,ok; 9 string s;10 scanf("%d",&cas);11 while(cas- 阅读全文
posted @ 2011-03-18 18:03 4.5.6 阅读(205) 评论(0) 推荐(0) 编辑

zoj2966 build the electric system

摘要: 1 2966最小树并查集模板Build The Electric System 2 #include<stdio.h> 3 #include<algorithm> 4 using namespace std; 5 int pre[501],fee; 6 struct side 7 { 8 int u,v,x; 9 }a[501];10 bool cmp(const side & a,const side & b)11 {12 return a.x<b.x;13 }14 int find(int x)15 {16 int r=x;17 while(p 阅读全文
posted @ 2011-03-18 17:58 4.5.6 阅读(411) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页