Location:
Search - poj 16
Search list
Description: poj解题报告,包括了许多很经典的算法-POJ problem solving reports, including a number of classic algorithms
Platform: |
Size: 5842944 |
Author: michael |
Hits:
Description: poj acm 1664 2694 2749 2816 递归算法部分题解~~很经典的递归应用-poj acm 1664 2694 2749 2816 recursive algorithm for part of the problem solution ~ ~ a very classic recursive application of
Platform: |
Size: 2048 |
Author: xaero |
Hits:
Description: pku 3613 Cow Relays
题意:给一个无向图,求从起点s到终点e尽力n条边的路径最小值。
边的数量2<=t<=100(每条边可以重复遍历)
算法:利用dp求出 path[ l ] [ i ] [ k ]=MIN(path[ l ][ i ] [ k ] , path[ l ][ i ] [ j ] + path[ l ][ j ] [ k ])
l 表示的是2的指数,假设 i 到 k 要途径 2^l 条边,那么他可以被分为两段 途径2^(l - 1)的路径。
利用开始的输入,然后递推,就可以推出所有的状态。
当需要找途经N条边的路径最小值时.将上面的值有效的组合起来.
上面求出了 1 2 4 8 16 …… 时的任意两条边的代价
对应的二进制是 1 10 100 1000 10000 ……
N可以拆成相应的二进制,然后用类似矩阵相乘的方法,往下推,就得到答案
m表示节点个数,(aXb)表示a行b列的矩阵一个 ,那么(1Xm)* path[ l ](mXm) 。
最终复杂度为O(t^3logn)
-Cow Relays
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 1163 Accepted: 433
Description
For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a relay race using the T (2 ≤ T ≤ 100) cow trails throughout the pasture.
Each trail connects two different intersections (1 ≤ I1i ≤ 1,000 1 ≤ I2i ≤ 1,000), each of which is the termination for at least two trails. The cows know the lengthi of each trail (1 ≤ lengthi ≤ 1,000), the two intersections the trail connects, and they know that no two intersections are directly connected by two different trails. The trails form a structure known mathematically as a graph.
To run the relay, the N cows position themselves at various intersections (some intersections might have more than one cow). They must position themselves properly so that they can hand off the baton cow-by-cow and end up at the proper finishing place.
Write a program to help position the cows. Find the shortest path that
Platform: |
Size: 1024 |
Author: zhang |
Hits:
Description: POJ acm 题目源码,总共5道题分别是1046 2028 2245 3749 3570-POJ acm problems Source, a total of five questions are the 1046 2028,2245 3749,3570
Platform: |
Size: 5236736 |
Author: 陈海宾 |
Hits:
Description: 用位操作+BFS解决.基本思想如下:给棋盘每一个状态赋予一个状态id,id计算方法是将棋盘与数的二进制表示联系起来,如题所给的数据:bwwbbbwbbwwbbwww状态id为6585,计算方法为1*2^0+0*2^1+1*2^2..1*2^12+0*2^13..=6585(其中b代表1,w代表0)在此基础上进行BFS搜索,首先理解一点,先点(0,0)再点(0,1)与先点(0,1)再点(0,0)对结果不造成任何影响.因此遍历棋盘的16个位置,将每次点击后的状态id利用树状结构保存.如-poj 1753
Platform: |
Size: 1024 |
Author: lzr |
Hits: