I used DP instead of Greedy. But got WA on PoJ, though it passed all web-searched cases. Maybe I have to use Greedy. BTW: a careless modification introduced an error, and it took me 1+ hours to debug. DETAILS Sth. about this DP solution: dp[iLake][nC…
Gone Fishing Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 30281 Accepted: 9124 Description John is going on a fishing trip. He has h hours available (1 <= h <= 16), and there are n lakes in the area (2 <= n <= 25) all reachab…
(- ̄▽ ̄)-* #include<iostream> #include<cstdio> #include<cstring> using namespace std; ; int n,h,H;//H:记录原本有多少小时的时间:h:贪心的时候,防止H被修改 int res[N],RES[N];//res[]:贪心的时候保存结果:RES[]:用于记录最终结果 int maxn,sum;//maxn:保存最终结果,即捕到的鱼最大值:sum:每轮贪心的时候,用来保存鱼最大值 s…
题意:小明打算做一个h((1 <= h <= 16))个小时钓鱼旅行.发现这里有n(2 <= n <= 25)个湖,而且所有的湖都在一条路的旁边.小明打算从第1个湖开始钓起,每在一个湖钓完鱼后,要到下一个湖但他可以选择是否要在这里钓鱼,并且他可以在任何一个湖结束他此次钓鱼的行程.输入给出小明在每个湖中单位时间内(5分钟)钓的鱼数fi[i],以及随单位时间的增长而线性递减di[i].没到下一个湖所需的时间为ti[i](单位时间).求怎么样选择钓鱼的湖使得小明钓到最多的鱼,以及在每个湖…
1.链接地址: http://bailian.openjudge.cn/practice/1042/ http://poj.org/problem?id=1042 2.题目: Gone Fishing Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 27652 Accepted: 8199 Description John is going on a fishing trip. He has h hours avail…