题目链接题意 :
N头牛,每个牛的坏脾气都有一个值,每个值都不相同,把这个值按照从小到大排序,如果两个值交换,那么会花掉这两个值之和的时间,让你花最少的时间将每个值从小到大排好序,求最小的总时间。思路
: 这个在黑书上有写,就是置换群,248页有写。写的挺详细的。每个状态都可以分为若干个循环的乘积。...
分类:
其他好文 时间:
2014-06-09 13:41:20
阅读次数:
253
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