YY_More

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年6月21日

摘要: 动规优化里面也要大量使用二分查找,我觉得这道题对二分查找考察的很好我的做法是在字典序中查找不小于输入字串的最小字串,对于它及它之后的字串判断是否以输入字串为前缀。由于题目中说有重复的字串,我给重复的字串加了个标记。//By YY_More#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct node{ char st[30];}; node f[10010];bool nok[10010];int n,k,p,q;char str[30];bool com 阅读全文
posted @ 2011-06-21 23:53 YY_More 阅读(313) 评论(0) 推荐(1) 编辑

摘要: 这几天都在琢磨动态规划的单调性优化了,必然会用到很多队列的操作所以先搞一道队列的模拟水题主要还是想试试高亮代码效果怎么样。。。这个代码还是之前用pascal写的。虽然写的很随意,但是时间空间,尤其是代码长度都都排在前面。//By YY_Moretype que=record data,pos:longint end;var n,l,r,m,k,h:longint; s:string; d:array[0..1000000]of que;begin readln(n); while n>0 do begin readln(s); if s[1]='E' then dec(n 阅读全文
posted @ 2011-06-21 23:24 YY_More 阅读(258) 评论(0) 推荐(1) 编辑