Human Gene Functions(dp)
2024-09-06 18:38:33
http://poj.org/problem?id=1080
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std; const int INF=<<;
int score[][];
void init()
{
score['A']['C']=score['C']['A']=-;
score['A']['G']=score['G']['A']=-;
score['A']['T']=score['T']['A']=-;
score['A']['-']=score['-']['A']=-;
score['C']['G']=score['G']['C']=-;
score['C']['T']=score['T']['C']=-;
score['C']['-']=score['-']['C']=-;
score['G']['T']=score['T']['G']=-;
score['G']['-']=score['-']['G']=-;
score['T']['-']=score['-']['T']=-;
}
int main()
{
int t,dp[][];
scanf("%d",&t);
init();
while(t--)
{
int len1,len2;
char s1[],s2[];
scanf("%d %s",&len1,s1+);
scanf("%d %s",&len2,s2+);
for (int i = ; i <= len1; i++)
{
for (int j = ; j <= len2; j++)
{
dp[i][j] = -INF;
}
}
dp[][] = ;
for (int i = ; i <= len2; i++)
{
dp[][i] = dp[][i-]+score[s2[i]]['-'];
}
for (int j = ; j <= len1; j++)
{
dp[j][] = dp[j-][]+score[s1[j]]['-'];
}
for (int i = ; i <= len1; i++)
{
for (int j = ; j <= len2; j++)
{
if (s1[i]!=s2[j])
{
dp[i][j] = max(dp[i][j],dp[i-][j-]+score[s1[i]][s2[j]]);
dp[i][j] = max(dp[i][j],
max(dp[i-][j]+score[s1[i]]['-'],dp[i][j-]+score['-'][s2[j]]));
}
else
{
dp[i][j] = max(dp[i][j],dp[i-][j-]+);
}
}
}
printf("%d\n",dp[len1][len2]);
}
return ;
}
最新文章
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(64)-WebApi与Unity注入
- 在Ubuntu|CentOS上安装Shutter截图工具及快捷键设置
- 包含块( Containing block ) 转自W3CHelp
- HTML5_ScrollInToView方法
- java之内部类(InnerClass)----非静态内部类、静态内部类、局部内部类、匿名内部类
- Android 判断app是否在前台运行
- Nginx使用手册目录
- windows server 2008 IP安全策略关闭端口,禁止ping,修改远程连接3389端口,开放指定端口
- SharePoint Server 2007 简体中文下载
- android面试题(转)
- FXBlurView用法
- 【poj解题】1308
- JavaScript学习总结 之对象
- Linux系统centOS7在虚拟机下的安装及XShell软件的配置
- python 用codecs实现数据的读取
- iOS 动态 Framework 对App启动时间影响实测
- 关于VMware虚拟机安装镜像时黑屏的解决办法
- [转]rancher 初步
- Pandas 使用笔记
- ASP.NET MVC应用安全性(一)——自定义错误处理