poj1054The Troublesome Frog】的更多相关文章

链接 想O(n*n)的DP  怎么想都超内存 看讨论有说hash+DP过的 实现比较繁琐 大部分直接暴力过了 直接枚举每个i j 与他们在一条线上的点 是不是给出的点 注意它必须能跳进和跳出 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> using namespace std; #define N 5010…
The Troublesome Frog Time Limit: 5000MS Memory Limit: 100000K Total Submissions: 9581 Accepted: 2883 Case Time Limit: 500MS Description In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, be…
题目来源:http://poj.org/problem?id=1054 题目大意: 有一种青蛙在晚上经过一片稻田,在庄稼上跳跃,会把庄稼压弯.这让农民很苦恼.我们希望通过分析青蛙跳跃的路径,找出对稻田造成最大损害的青蛙.青蛙跳跃时总是沿着直线并且步长均匀,但不同青蛙可能步长或方向不一样.如下图所示: 稻田庄稼是均匀地种在矩形网格交点处的,如下左图所示.青蛙总是会完全穿过这片稻田,也就是说从稻田外跳入并最终跳出稻田.如下右图所示. 有许多青蛙会穿过这片稻田,从庄稼上跳跃.我们可以知道那些庄稼被青蛙…
Description In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, because the frogs jump through your rice paddy at night, flattening rice plants. In the morning, after noting which plants hav…
Description In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, because the frogs jump through your rice paddy at night, flattening rice plants. In the morning, after noting which plants hav…
In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, because the frogs jump through your rice paddy at night, flattening rice plants. In the morning, after noting which plants have been flatt…
题目链接 题意 :给你r*c的一块稻田,每个点都种有水稻,青蛙们晚上会从水稻地里穿过并踩倒,确保青蛙的每次跳跃的长度相同,且路线是直线,给出n个青蛙的脚印点问存在大于等于3的最大青蛙走的连续的脚印个数. 思路 : 暴力了一下,顺便剪剪枝就可以过.... //POJ1054 #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> using namespac…
题目链接 看到分类里是dp,结果想了半天,也没想出来,搜了一下题解,全是暴力! 不过剪枝很重要,下面我的代码 266ms. 题意: 在一个矩阵方格里面,青蛙在里面跳,但是青蛙每一步都是等长的跳, 从一个边界外,跳到了另一边的边界外,每跳一次对那个点进行标记. 现在给你很多青蛙跳过后的所标记的所有点,那请你从这些点里面找出 一条可能的路径里面出现过的标记点最多. 分析:先排序(目的是方便剪枝,break),然后枚举两个点,这两个 点代表这条路径的起始的两个点.然后是三个剪枝,下面有. 开始遍历时,…
1.链接地址: http://poj.org/problem?id=1054 http://bailian.openjudge.cn/practice/2812 2.题目: 总时间限制: 10000ms 内存限制: 65536kB 描述 在韩国,有一种小的青蛙.每到晚上,这种青蛙会跳越稻田,从而踩踏稻子.农民在早上看到被踩踏的稻子,希望找到造成最大损害的那只青蛙经过的路径.每只青蛙总是沿着一条直线跳越稻田,而且每次跳跃的距离都相同. 如下图所示,稻田里的稻子组成一个栅格,每棵稻子位于一个格点上.…
题目是非常经典的搜索+剪枝.题意简言之就是,青蛙需要沿着直线踩着踏点通过田地,并且踏点需要至少为3.问哪条路径青蛙踩坏的作物最多.很好的一个条件是青蛙每次移动都是等间距的.题目需要注意将其排序. #include <iostream> using namespace std; #define MAXNUM 5005 typedef struct { int x, y; } point_st; point_st points[MAXNUM]; bool Fields[MAXNUM][MAXNUM…