FZU 2079 最大获利(dp) 自己很难想到,囧 dp[i]表示处理完前i 个点的最大收益。有两种情况:(1)第i 个点不投资,那么dp[i] = dp[i - 1](2)第i 个点投资,那么dp[i] = max(dp[k] + get(k + 1,i) - sigma(c[j]) (k + ...
分类:
其他好文 时间:
2014-08-08 01:53:45
阅读次数:
331
Problem 2105 Digits CountProblem DescriptionGiven N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations:Operation 1:AND opn L RHere opn, L...
分类:
其他好文 时间:
2014-08-07 21:53:40
阅读次数:
257
Problem 2168 防守阵地 I
Accept: 128 Submit: 392
Time Limit: 3000 mSec Memory Limit : 32768 KB
Problem Description
部队中共有N个士兵,每个士兵有各自的能力指数Xi,在一次演练中,指挥部确定了M个需要防守的地点,按重要程度从低到高排序,依次以数字1到M标注每个地点的重...
分类:
其他好文 时间:
2014-08-07 15:58:20
阅读次数:
237
Problem 2150 Fire Game
Accept: 392 Submit: 1502
Time Limit: 1000 mSec Memory Limit : 32768 KB
Problem Description
Fat brother and Maze are playing a kind of special (hentai) game on an N...
分类:
其他好文 时间:
2014-08-05 15:56:19
阅读次数:
291
Problem 2148 Moon Game
Accept: 386 Submit: 1080
Time Limit: 1000 mSec Memory Limit : 32768 KB
Problem Description
Fat brother and Maze are playing a kind of special (hentai) game in...
分类:
其他好文 时间:
2014-08-02 13:01:13
阅读次数:
224
Problem Description
n个元素的集合{1,2,...,n}可以划分若干个非空子集。例如,当n=4时,集合{1,2,3,4}可以划分为15个不同的非空子集如下:
{{1},{2},{3},{4}},
{{1,2},{3},{4}},
{{1,3},{2},{4}},
{{1,4},{2},{3}},
{{2,3},{1},{4}},
{{2,4},{1},{3}},
{...
分类:
其他好文 时间:
2014-07-30 10:03:13
阅读次数:
273
运用KMP算法解决的一道题,求一下Next数组,然后直接找最后一个元素的next值,依次找下标为next的元素,直接用总数减去next值就是要求的一个数,直到找到next的值为0的时候结束!#include#include#includeusing namespace std;int a[10000...
分类:
其他好文 时间:
2014-07-28 15:24:03
阅读次数:
300
#include #include 考查了对next数组的了解using namespace std;#define max 1000005int next[max],l,ans[max];char s[max];void getNext(){ int j,k; next[0]=-1; j=0;k=...
分类:
其他好文 时间:
2014-07-27 23:26:49
阅读次数:
174
Problem DescriptionFor each prefix with length P of a given string S,ifS[i]=S[i+P] for i in [0..SIZE(S)-p-1],then the prefix is a “period” of S. We wa...
分类:
其他好文 时间:
2014-07-27 22:27:09
阅读次数:
249
链接:http://acm.fzu.edu.cn/problem.php?pid=2150
题意:一个平面上有n堆草,两个人想在上面OOXX,所以要把草烧光(我也不知道为什么,题目这么说的),一个人只能烧一堆草,草烧着的话一个单位时间后会烧着它周围的草,当然如果它周围有草的话,如果草堆大于2个他们就不能烧完输出-1,输出至少要多长时间他们能把草烧完。注意两个人可以同时烧同一堆草。
拿到...
分类:
其他好文 时间:
2014-07-26 02:23:26
阅读次数:
189