hdu2612 Find a way】的更多相关文章

#include<stdio.h>#include<string.h>#include<queue>#define INF 0x3f3f3f3fusing namespace std;//hdu2612,Y,M不能走 int s[210][210],lg[210][210],lg1[210][210];int n,m;struct node{ int x;//hang int y;//lie}a,b,d[4050];int bfs1(int a3,int b3){ qu…
Problem Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the countryside, but Merceki’s home is…
原题链接 水了一天bfs了 题意:2个人分别从Y,M出发,到达其中任意一个“@” (图中有多个“@”点),2人到达的必须是同一个“@”点,求最短的路程和 思路:bfs搜2次,用一个2维数组记录到达各个“@”的距离之和 再遍历求最小的(用一个数组就可以的原因是Y可以到达的地方M一定也能到达,因为Y,M必然可以相遇,所以Y和M必然是连通,一开始还怀疑了一下自己) #include "map" #include "queue" #include "math.h&…
Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki. Yifenfei’s home is at the countryside, but Merceki’s home is in the…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 题意:求2个点到任意一个KFC的距离之和,使其最小. 分析:由两个点出发分别两次bfs,求得到每个KFC的距离,再枚举每个KFC求得最小距离和即可.刚开始以为KFC不能通过,wa了一次,坑... #include <cstdio> #include <cstring> #include <cmath> #include <iostream> #includ…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 思路: 裸的BFS,对于Y,M分别进行BFS,求出其分别到达各个点的最小时间: 然后对于@的点,将两者的最小时间相加即为到达此点的总时间,遍历所有@点,更新结果即可: 代码: #include<iostream> #include<cstdlib> #include<cstdio> #include<cstring> #include<queue&g…
我要被这个好用的memset气死了...... 真香 #include <cstring> #include <string> int main () { ]; memset(a, "真香", sizeof(a)); } 这道题也是出现了和昨天一样的情况,半小时写完,改bug改了1个小时,结果最后啸神说memeset不能随便给大数赋值,结果一改就改对了emm,真的是要被自己菜死了. 本题大意:给定一张地图,Y和M同时走向附近的KFC,找出Y和M距离和最短的KFC…
Find a way Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 48   Accepted Submission(s) : 15 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Pass a year learning in Ha…
Find a way Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12795    Accepted Submission(s): 4105 Problem Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally…
 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/N这两天总是因为一些小错误耽误时间,我希望自己可以细心点.珍惜时间,珍爱生命!#include<iostream> #include<algorithm> #include<string.h> #include<ctype.h> #include<stdio.h> #include<stdlib.h>…