HDU.2612 Find a way (BFS) 题意分析 圣诞节要到了,坤神和瑞瑞这对基佬想一起去召唤师大峡谷开开车.百度地图一下,发现周围的召唤师大峡谷还不少,这对基佬纠结着,该去哪一个...坤神:我要去左边的这个(因为离自己比较近 哈哈~)..瑞瑞:我要去右边的这个(因为离自己比较近 嘿嘿~) --..这对基佬闹矛盾了,开车有危险了! 为了不让他们去召唤师大峡谷坑人,riot决定让他们去X召唤师大峡谷,保证他俩所走的路程和最短.每走一个点需要花费11分钟,输出他们一共花费多少时间(最短时…
Find a way Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 16184    Accepted Submission(s): 5194 Problem Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2612 题意 有两个人 要去一个城市中的KFC 一个城市中有多个KFC 求两个人到哪一个KFC的总时间最少 求出这个最少的总时间 思路 用BFS打一遍表 求出两个人每人到 每个 KFC 的时间 然后 遍历一下 更新答案 AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include <cstdl…
题目链接:hdu2612 思路:题意是求两个人到某一个KFC花费时间和最小,其实就是求最短距离和,用两个BFS,分别以两个人为起点,分别记录下两人到每个KFC的距离,然后求出最小的和 #include<stdio.h> #include<string.h> #include<queue> #include<algorithm> #define N 205 using namespace std; char map[N][N]; int v[N][N],ans…
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…
题目: 链接 思路: 用BFS分别以‘Y’和‘M’的位置为起点进行两次搜索,并把这两次的搜索结果在一个二维数组中保存下来,在对地图遍历遇到‘@’更行最小值. PS: 如果用‘Y’和‘M’点分别去搜每个‘@’,这样妥妥的会超时.当时做这个题脑抽的一批……(烦!!!) 另外如果‘Y’和‘M’到不了‘@’这里的值为0,应该把这种情况排除. 代码: //#include <bits/stdc++.h> #include <queue> #include <cstdio> #in…
Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her way to a safe location (one that is never destroy…
Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ...…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2069 Problem Description Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money.For example, if we have 11…
Problem Description "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:  N=a[1]+a[2]+a[3]+...+a[m…