hdu5024 Wang Xifeng's Little Plot (水】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=5024 网络赛 Wang Xifeng's Little Plot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 239    Accepted Submission(s): 156 Problem Description <Dream of the…
题意:给定一个n*m的矩阵,#表示不能走,.表示能走,让你求出最长的一条路,并且最多拐弯一次且为90度. 析:DP,dp[i][j][k][d] 表示当前在(i, j)位置,第 k 个方向,转了 d 次变的最多次数,然后用记忆化搜索就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cs…
题意:从任意一个任意一个可走的点开始找一个最长的路,这条路如果有转弯的话, 那么必须是 90度,或者没有转弯! 思路: 首先用dfs将所有可走点开始的 8 个方向上的线段的最长长度求出来 ! step[i][j][k] 表示的是(i,j)沿着k方向一直走到头或者转弯时的最长步数! 最后枚举每一个可走点转弯为90度的路径,找到最长的长度! step[i][j][k1] + step[i][j][k2] 就是 (i, j)这个点 k1 和 k2方向构成90度! #include<iostream>…
题意:求一个图中只有一个90°拐点的路的最大长度. 分析:枚举每一个为'.'的点,求出以该点为拐点的八种路中的最大长度,再比较所有点,得出最大长度即可. 如上样例,这样是个90°的角... 注意:最多只有一个拐点,但是通过枚举每一个点的方法,可以在枚举到一条没有拐点的路的端点处时计算出这条路的长度,所以不用特判平角的情况. #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype>…
pid=5024">点击打开链接 Wang Xifeng's Little Plot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 556    Accepted Submission(s): 362 Problem Description <Dream of the Red Chamber>(also <Th…
Wang Xifeng's Little Plot Problem Description <Dream of the Red Chamber>(also <The Story of the Stone>) is one of the Four Great Classical Novels of Chinese literature, and it is commonly regarded as the best one. This novel was created in Qin…
此题一开始用暴力做,后来发现斜着走的时候其实暴力不太好写,于是改用搜索写了 #include <iostream> #include <stdio.h> #include <memory.h> using namespace std; ][]= {}; ][]= {}; ][]= {}; ][][]= {}; int n; ]= {-,,-, }; ]= {-,, ,-}; int dfs(int curx,int cury,int num) { || cury<…
Wang Xifeng's Little Plot http://acm.hdu.edu.cn/showproblem.php?pid=5024 预处理出每个点八个方向能走的最远距离,然后枚举起点,枚举方向,每走一步都要枚举左转和右转的情况,因为预处理好了,所以可以直接算出来. #include<cstdio> #include<algorithm> using namespace std; ; char a[M][M]; ]; ,-,,,,,,-}; ,,,,,-,-,-}; b…
[A]-_-/// [B]线段树+位运算(感觉可出) [C]地图BFS,找最长线 [D]地图BFS,加上各种复杂情况的最短路-_- [E]-_-/// [F]三分+圆与线段的交点,计算几何 [G]-_-/// [H]线段树+树链剖分 [I]后缀数组+二分 [J]DFS搜索 这场网赛当时自己完成了的也就是两道地图题,过去好久了才想到还是该记录下来... [C] Wang Xifeng's Little Plot Time Limit: 2000/1000 MS (Java/Others)    M…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…