loj模拟赛t1
来源:互联网 发布:jdbc连接数据库步骤 编辑:程序博客网 时间:2024/05/29 08:27
//水题,二十分钟绝对应该搞定...而我搞了四十分钟,就是小模拟而已
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int maxn=5000010;
ll n,k,vis[2000010];
char s[maxn];
int main(){
scanf("%s",s+1);
//for(int i=1;i<=strlen(s+1);i++) cout<<s[i];
//cout<<endl;
scanf("%lld",&k);
int len=strlen(s+1);
long long now=0,ans=0,now1;
for(int i=1;i<=len;i++){
//cout<<i<<' '<<endl;
int j=i+k-1;
if(j>len) break;
if(i==1){
for(int k=1;k<=j;k++){
if(s[k]=='A') now1=0;
else if(s[k]=='G') now1=1;
else if(s[k]=='C') now1=2;
else if(s[k]=='T') now1=3;
now=now*4+now1;
}
//cout<<"now: "<<now<<endl;
vis[now]=1;
ans=max(ans,vis[now]);
}
else{
if(s[i-1]=='A') now1=0;
if(s[i-1]=='G') now1=1;
if(s[i-1]=='C') now1=2;
if(s[i-1]=='T') now1=3;
now-=now1*pow(4,k-1);
if(s[j]=='A') now1=0;
if(s[j]=='G') now1=1;
if(s[j]=='C') now1=2;
if(s[j]=='T') now1=3;
now=now*4+now1;
vis[now]++;
ans=max(ans,vis[now]);
}
//cout<<i<<' '<<now<<endl;
}
cout<<ans<<endl;
return 0;
}
- loj模拟赛t1
- 20160823模拟赛T1
- 【20160904】NOIP模拟赛T1
- 2016.10.13模拟赛T1
- 【faebdc的模拟赛】T1错位
- 2016.7.15_模拟赛t1 立方体
- snacks的模拟赛(t1)
- vijos时光的秘密模拟赛(t1)
- JS模拟T1
- June 11th 模拟赛C T1 Sandcas Solution
- June 11th 模拟赛B T1 刺杀大使 Solution
- July 14th 模拟赛C T1 输油管道 Solution
- July 15th 模拟赛C T1 游泳池 Solution
- July 16th 模拟赛C T1 竞赛排名 Solution
- July 17th 模拟赛C T1 Gift Solution
- September 3rd 模拟赛C T1 祖孙询问 Solution
- September 10th 模拟赛C T1 电影票 Solution
- September 17th 模拟赛C T1 铁轨 Solution
- python设计模式(访问者模式)
- 20171107 排版后台代码
- gnuplot 双纵坐标 对数坐标 坐标范围等
- Android 简单EventBus登录界面与传值(粘性事件)
- UVA658,隐式图+最短路+二进制子集枚举
- loj模拟赛t1
- 一行代码轻松搞定各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
- PHAsset获得视频URL时,用requestAVAssetForVideo有时会得到AVComposition这个对象
- Linux经典问题—五哲学家就餐问题
- mkdocs完美支持sequence时序图(亲测可用)
- Java
- yum安装时报Another app is currently holding the yum lock; waiting for it to exit...
- 正则表达式常用通配符
- 如何用九条命令在一分钟内检查Linux服务器性能?