LA 3716
来源:互联网 发布:nginx中文 编辑:程序博客网 时间:2024/06/05 18:49
#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;struct node{int lo,v;}G[150005];bool cmp(const node &a,const node &b){if(a.v==b.v)return a.lo<b.lo;elsereturn a.v>b.v;}char str1[150050],str2[150050];int main(){int n,p;while(~scanf("%d%d",&n,&p)&&(n+p)){scanf("%s",str1);scanf("%s",str2);int t=0,res=0;G[0].lo=0,G[0].v=0;for(int i=1;i<=n;i++){if(str1[i-1]!=str2[i-1])t++; G[i].v=100*t-i*p;G[i].lo=i;}sort(G,G+1+n,cmp);int lo=G[0].lo;for(int i=1;i<=n;i++){if(lo<G[i].lo)res=max(res,G[i].lo-lo);elselo=G[i].lo;}if(res)printf("%d\n",res);elseprintf("No solution.\n");}}
阅读全文
0 0
- LA 3716
- LA 3716 DNA Regions
- la la la, la la la
- LA 3716 DNA Regions 数形结合 -
- LA 3716 DNA Regions (二分/排序)
- LA 3942
- LA 4670
- LA 3135
- LA 3644
- LA 3027
- LA 5059
- LA 3644
- La 3942
- LA 3126
- LA 4329
- LA 3384
- LA 4329
- LA 2995
- 文章标题
- 深入理解 Android 之 View 的绘制流程(三)_Layout
- fork()函数的do_fork()源码分析
- 关于View.VISIBLE、INVISIBLE、GONE区别
- HDU
- LA 3716
- JVM学习框架及内存结构初略理解
- CentOS7 安装 Virtualenv
- 学习知识复习
- springmvc启动流程源码解析
- Floyd-Warshall算法求矩阵的传递闭包
- 引发的异常:“System.FormatException"
- bootstrap中的样式分类
- Node.js 写入文件流的缓存问题探讨