题目链接 :http://poj.org/problem?id=2472 Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes at the Cook Country Assessor's Office…
最短路问题变形. 题意是给你一些道路,和路过时不被抓的概率. 要求找一条到达目的地时不被抓的最大概率概率. 初始 dis[]设为 1 .其余为 0 .找最大就可以. #include<cstdio> #include<cstring> #include<string> #include<queue> #include<algorithm> #include<map> #include<stack> #include<…
Instantaneous Transference Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 6177   Accepted: 1383 Description It was long ago when we played the game Red Alert. There is a magic function for the game objects which is called instantaneous…
106 miles to Chicago Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3931   Accepted: 1827   Special Judge Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Educat…
链接: http://poj.org/problem?id=2253 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/D Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21206   Accepted: 6903 Description Freddy Frog is sitting on a stone in the…
题目链接:http://poj.org/problem?id=1797 题意:从路口1运货到路口n,最大的运货重量是多少?题目给出两路口间的最大载重. 思路:j加到s还是接到K下面,取两者的较大者,而使得载重量较大,而接到k下面,载重量是dis[k]和maps[k][j]的较小者. #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; #define INF 0x…
题意:N个数,M个询问,每个询问为一个区间,求区间最长连续子序列,要求每个数都不同(perfect sequence,简称PS). 题解:很容易求出以每个数为结尾的ps,也就是求区间的最大值.有一个不同就是长度可能会超出询问范围,所以先对PS的首位置二分,然后RMQ.注意一点,序列有可能出现负数,所以先加最大值变为正数.其实也不算变形,挺裸的…… 这题卡线段树,然而我只会线段树,心塞…… 代码(树状数组): #include <iostream> #include <cstring>…
题目:http://poj.org/problem?id=3046 思路: dp [i] [j] :=前i种 构成个数为j的方法数. #include <cstdio> #include <cstring> #include <iostream> int T,A,S,B; int hash[1010]; int dp[1010][10100]; const int MOD=1e6; using namespace std; int main(){ while(cin&g…
题目链接:http://poj.org/problem?id=2312 挺有趣的一道题目,然而很容易WA,我就WA了一次,虽然我Debug的时候已经知道哪里出问题了,就是比如说我搜到B和E时,从B搜第三个点,B左边的E就被搜了,step为3,然而其实他是step为2, 这里的处理方法很是巧妙,可以从B出发时,把B换成E,step+1,形成一个新的结点加入到队列中去. 之后,和杰哥交流了这下题,我对这个BFS又有了新的一点认识,BFS时,每次搜索的点,都要是同一级别的点,想这里B,和E就不是同一级…
本文转载,出处:http://www.cnblogs.com/Findxiaoxun/articles/3398075.html 很巧妙的01背包升级.看完题目以后很明显有背包的感觉,然后就往背包上靠.把s看成是空间,f看成是价值,转换成了01背包经典模型(没有想到,,,).可,s是负值,这就涉及到一个问题,如果按照普通的01背包,(01背包的倒序原因请参看这个http://hi.baidu.com/findxiaoxun/item/9abf560127a155c091571868) ;i<n;…