随笔分类 -  队列

摘要:题目崔老师推荐,用BFS找路径,然后由于一开始的时候不知道那个打架的时间要费时然后WA了一次,然后当时看见有discuss里说开头可能有怪兽然后又没加优先队列然后又WA了了一次,最后因为优先队列的那个排序错了又WA了一次,一晚上就只做了这一道题。。。悲哀= =。。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 char map[205][205]; 4 struct node 5 { 6 int x,y,step,f;//f存先驱,step是当前的步数。 7 }q[400005]; 8 9 int way... 阅读全文
posted @ 2012-09-06 21:34 某某。 阅读(206) 评论(0) 推荐(0)
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1180昨天晚上开始做这道题。。。以前打算做做这题但是不知道这优先队列应该怎么用。。。昨晚这道题才有点深入的了解些。。。这道题因为楼梯会变换方向会变成不同的路,所以一不能标记。。。而且要注意边界这个是我纠结了4歌小时候都最后经大神鉴定改错后的代码。。。-#include <string.h>#include <stdio.h>char map[30][30];int dis[4][2]= {{1,0},{0,1},{-1,0},{0,-1}};struct node{ int 阅读全文
posted @ 2012-08-21 20:02 某某。 阅读(204) 评论(0) 推荐(0)
摘要:1 /*这题的错误是和同学熬夜找出来的呃= =。。。*/ 2 3 #include<stdio.h> 4 #include<string.h> 5 int main() 6 { 7 int front,rear,i,f,j,n,t,q[10000]; 8 char s[20]; 9 scanf("%d",&n); 10 rear =0,front=0; 11 for(i=0;i<n;i++) 12 { 13 rear=i; 14 sca... 阅读全文
posted @ 2012-02-22 23:30 某某。 阅读(162) 评论(0) 推荐(0)