当前位置: 首页 > news >正文

建设网站怎么查明细黑糖 wordpress 主题

建设网站怎么查明细,黑糖 wordpress 主题,徐州建设工程交易网招标公告最新,做房地产网站广告销售http://codeforces.com/contest/814/problem/C 【题意】 给定一个长度为n的字符串s#xff0c;一共有q个查询#xff0c;每个查询给出一个数字m和一个字符ch#xff0c;你的操作是可以改变字符串中的某些字母#xff0c;最多改变m个#xff0c;问操作后只包含字符ch的连续…http://codeforces.com/contest/814/problem/C 【题意】 给定一个长度为n的字符串s一共有q个查询每个查询给出一个数字m和一个字符ch你的操作是可以改变字符串中的某些字母最多改变m个问操作后只包含字符ch的连续子序列最长是多少 【思路】 方法一 有这么一类问题需要在给的一组数据中找到不大于某一个上限的“最优连续子序列” 于是就有了这样一种方法找这个子序列的过程很像毛毛虫爬行方式比较流行的叫法是“尺取法”。 有关尺取的练习 http://blog.csdn.net/acmer_sly/article/details/59524223 http://acm.hdu.edu.cn/showproblem.php?pid5328 尺取是线性的所以总的时间复杂度是O(qn). 方法二dp,对每个字母预处理时间复杂度是O(26n^2)。 【Accepted】 1 #include iostream2 #include stdio.h3 #include cmath4 #include vector5 #include algorithm6 #include set7 #include map8 #include queue9 #include deque 10 #include stack 11 #include string 12 #include bitset 13 #include ctime 14 #includealgorithm 15 #includecstring 16 using namespace std; 17 typedef long long ll; 18 const int maxn1502; 19 int n,q,m; 20 char s[maxn]; 21 char ch[5]; 22 23 24 int solve(char c) 25 { 26 //双指针 27 int l0,r0; 28 int ans0; 29 int cnt0; 30 while(lnrn) 31 { 32 //右端点不断往后扫直到不能再向右 33 while(rn (s[r]c||cntm)) 34 { 35 if(s[r]!c) 36 { 37 cnt; 38 } 39 r; 40 } 41 //记下当前l下的解 42 ansmax(ans,r-l); 43 while(lr s[l]c) 44 { 45 l; 46 } 47 //找到第一个使cnt-1的l,r才能继续向右更新 48 l; 49 cnt--; 50 } 51 return ans; 52 } 53 int main() 54 { 55 while(~scanf(%d,n)) 56 { 57 scanf(%s,s); 58 scanf(%d,q); 59 for(int i0;iq;i) 60 { 61 scanf(%d%s,m,ch); 62 int anssolve(ch[0]); 63 printf(%d\n,ans); 64 } 65 } 66 return 0; 67 } 尺取 1 #include iostream2 #include stdio.h3 #include cmath4 #include vector5 #include algorithm6 #include set7 #include map8 #include queue9 #include deque 10 #include stack 11 #include string 12 #include bitset 13 #include ctime 14 #includealgorithm 15 #includecstring 16 using namespace std; 17 typedef long long ll; 18 int n,q,m; 19 const int maxn1502; 20 char s[maxn]; 21 int dp[maxn][27]; 22 char ch[5]; 23 void Init() 24 { 25 memset(dp,-1,sizeof(dp)); 26 for(int c0;c26;c) 27 { 28 for(int i0;in;i) 29 { 30 int num0; 31 for(int ki;k0;k--) 32 { 33 if(s[k](char)(ca)) 34 { 35 num; 36 } 37 //替换i-k1-num个字母达到的子段长度是i-k1,枚举所有的子段不断更新找到最大值共n^2个子段。 38 dp[i-k1-num][c]max(dp[i-k1-num][c],i-k1); 39 } 40 } 41 } 42 } 43 int main() 44 { 45 while(~scanf(%d,n)) 46 { 47 scanf(%s,s); 48 Init(); 49 scanf(%d,q); 50 for(int i0;iq;i) 51 { 52 scanf(%d%s,m,ch); 53 if(dp[m][ch[0]-a]-1) 54 { 55 printf(%d\n,n); 56 } 57 else 58 { 59 printf(%d\n,dp[m][ch[0]-a]); 60 } 61 } 62 } 63 return 0; 64 } dp  转载于:https://www.cnblogs.com/itcsl/p/6963357.html
http://www.yutouwan.com/news/42003/

相关文章:

  • 网站打开速度多少时间救护车网站找谁做
  • 有关网站设计与制作的论文建一个信息 类网站
  • wordpress本地网站搭建整套课程app推广一年赚了百万
  • 公司网站建设准备资料windows更新wordpress
  • 东莞网站建设对比谷歌优化是什么意思
  • 全中文网站开发wordpress大前端1.9
  • 网站界面设计的表现wordpress中文说明书
  • 聊城定制网站建设公司做网站的表情包
  • 网站开发团队简介如何写顺企网企业名录
  • 贴吧做网站做游戏制作 网站
  • 四川建设厅官方网站证书查询html5手机网站开发
  • 安卓和网站开发找工作有什么网站开发客户
  • 给企业做网站的公司做谷歌网站使用什么统计代码
  • 桂林做旅游网站失败的网站东莞容桂网站制作
  • 知乎做笔记的网站软件下载网站制作
  • 常德网站建设公司装潢建筑公司网站设计
  • mj wordpress北京网站seo招聘
  • 深圳沙井做网站公司注册网站免费
  • 个人可以建设农资网站吗建网站要多少钱一台
  • 网站维护主要是做哪些网站解决方案模板
  • 阿里巴巴 网站 建设宁波外贸公司排行榜
  • 苏州 网站的公司哪家好京东云wordpress后台
  • TP5.1做的网站首页被挂马原因网站开发现在用什么语言
  • 规划建立一个网站如何再网站上做免费广告
  • 软件平台开发公司厦门seo网站建设费用
  • 做平面图片的网站wordpress默认模板
  • 鲜花网站建设的目标网页美工设计需求说明
  • 网站建设的工作内容wordpress插件更新推送
  • 高密专业网站建设价格如何建立一个网站链接的文档
  • 山东春季高考网站建设怎么创建视频网站