ACM: 动态规划题 poj 1925
来源:互联网 发布:金山tw域名遭抢注 编辑:程序博客网 时间:2024/06/08 02:54
From Spiderman's apartment, where he starts, to the tower there isa straight road. Alongside of the road stand many tall buildings,which are definitely taller or equal to his apartment. Spidermancan shoot his web to the top of any building between the tower andhimself (including the tower), and then swing to the other side ofthe building. At the moment he finishes the swing, he can shoot hisweb to another building and make another swing until he gets to thewest tower. Figure-1 shows how Spiderman gets to the tower from thetop of his apartment – he swings from A to B, from B to C, and fromC to the tower. All the buildings (including the tower) are treatedas straight lines, and during his swings he can't hit the ground,which means the length of the web is shorter or equal to the heightof the building. Notice that during Spiderman's swings, he cannever go backwards.
You may assume that each swing takes a unit of time. As inFigure-1, Spiderman used 3 swings to reach the tower, and you caneasily find out that there is no better way.
Input
Output
Sample Input
2
6
0 3
3 5
4 3
5 5
7 4
10 4
3
0 3
3 4
10 4
Sample Output
3
-1
题意: 蜘蛛侠去救女友, 每次用web射在楼顶, 然后经过一个扇形弧线, 继续发射web, 知道最右端
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 2000005
#define SIZE 5005
int n;
int x[SIZE], y[SIZE];
int dp[MAX], dist[SIZE];
inline int min(int a, int b)
{
}
int DP()
{
}
int main()
{
//
}
- ACM: 动态规划题 poj 1925
- ACM: 简单动态规划题 poj 2955
- ACM: 动态规划题 poj 2241
- ACM: 动态规划题 poj 1054
- ACM: 动态规划题 poj 2948
- ACM: 动态规划题 poj 3034
- ACM: 动态规划题 poj 2411
- ACM: 动态规划题 poj 1947
- ACM: 动态规划题 poj 2486
- ACM: 动态规划题 poj 3140
- ACM: 动态规划题 poj 3659
- ACM: 动态规划题 poj 2923
- ACM: dp动态规划题(难) poj 3267 …
- ACM: dp题(动态规划) poj 2151 (d…
- ACM: 树状DP 动态规划题 poj 1463 …
- ACM: 动态规划题 poj 2057 树状DP
- ACM:动态规划题 poj 1015
- ACM: 动态规划题 poj&nb…
- ACM: 《黑书》高性能计算机
- ACM: 动态规划题 poj 1054
- ACM: 动态规划题 poj3280
- ACM: 树状数组 poj 2029 动态规划…
- ACM: 动态规划题 poj 2948
- ACM: 动态规划题 poj 1925
- ACM: 动态规划题 poj 3034
- ACM: 动态规划题 poj 3254 学习状…
- ACM: 动态规划题 poj 2411
- 埃拉托斯特尼筛法求素数
- 兴趣学习: 摆脱“三天打渔两天晒网”…
- ACM: 动态规划题 poj 1185 想了两…
- windows.h
- ACM: 动态规划题 poj 2057 树状DP