Description
Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting tired, though, so they want to be ...
分类:
其他好文 时间:
2014-06-08 15:55:10
阅读次数:
199
Catch That Cow
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 44070
Accepted: 13764
Description
Farmer John has been informed of the location of a fugitiv...
分类:
其他好文 时间:
2014-06-08 15:44:43
阅读次数:
238
点击打开链接
两次求最短路(第二次把边反向求)
1、spfa
//poj 3268 Silver Cow Party
//SPFA
#include
#include
#include
using namespace std;
const int M = 100000 + 100;
const int N = 1000 + 100;
const int inf = 1...
分类:
其他好文 时间:
2014-06-08 05:29:39
阅读次数:
241
Catch That CowDescriptionFarmer John has been
informed of the location of a fugitive cow and wants to catch her immediately.
He starts at a point N (0...
分类:
其他好文 时间:
2014-06-05 19:54:29
阅读次数:
298
Catch That Cow
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 43851
Accepted: 13674
Description
Farmer John has been informed of the location of a fugitiv...
分类:
其他好文 时间:
2014-06-05 07:45:38
阅读次数:
220
裸dijkstra
思路:以x为源点,求到其他点的最短路,之后把邻接矩阵转置,再求一次x源
点的最短路,这样就一次是来的,一次是走的,相加迭代最大值即可
代码:
/*
poj 3268
8108K 47MS
*/
#include
#include
#define MAXN 1005
#define MAX_INT 2147483647
using namespace s...
分类:
其他好文 时间:
2014-06-04 23:32:57
阅读次数:
303
http://poj.org/problem?id=3270这道题就是给你一个无序序列转换成有序序列需要花费的代价最小,交换a和b代价为a+b; 1
#include 2 #include 3 #include 4 #define maxn 20000 5 using namespace st...
分类:
其他好文 时间:
2014-06-03 13:14:32
阅读次数:
272
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,0...
分类:
其他好文 时间:
2014-06-03 05:30:23
阅读次数:
394
题目大意:
一个农主寻找牛。给出农主的位置n和牛的位置k。农主可以通过n-1或者n+1或者n*2的步伐找牛,问至少多少步才能找到自己的牛。解题思路:
简单的BFS。把农主的每一种可能的步伐通过BFS存到栈中,然后看最少多少步到达K坐标。代码: 1 #include 2 #include 3 ...
分类:
其他好文 时间:
2014-05-31 15:27:27
阅读次数:
252
POJ 3278 Catch That Cow
题目大意:
告诉你起点位置和终点位置,你可以有三种操作,从某个位置x,可以到达x-1,x+1,2*x,问你从起点到终点最短时间?
解题思路:
利用bfs枚举位置即可
但是刨除以下情况,也就是剪枝一下
1、当x终点位置时,x+1和2*x均不能到达
解题代码:见本文详细...
分类:
其他好文 时间:
2014-05-21 14:33:08
阅读次数:
241