poj 1080 Human Gene Functions
来源:互联网 发布:国外域名申请 编辑:程序博客网 时间:2024/06/10 00:09
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int dp[150][105],match[150][105];char s1[500010],s2[500010];void Init(){ match['A']['A']=match['C']['C']=match['G']['G']=match['T']['T']=5; match['A']['C']=match['C']['A']=match['A']['T']=match['T']['A']=-1; match[' ']['T']=match['T'][' ']=-1; match['A']['G']=match['G']['A']=match['C']['T']=match['T']['C']=-2; match['G']['T']=match['T']['G']=match['G'][' ']=match[' ']['G']=-2; match['A'][' ']=match[' ']['A']=match['C']['G']=match['G']['C']=-3; match['C'][' ']=match[' ']['C']=-4;}int main(){ int t,n,m,i,j,k; while(scanf("%d",&t)!=EOF) { Init(); while(t--) { scanf("%d",&n);scanf("%s",s1+1); scanf("%d",&m);scanf("%s",s2+1); memset(dp,0,sizeof(dp)); for(i=1;i<=n;i++) dp[i][0]=dp[i-1][0]+match[s1[i]][' ']; for(i=1;i<=m;i++) dp[0][i]=dp[0][i-1]+match[' '][s2[i]]; for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { dp[i][j]=max(dp[i-1][j]+match[s1[i]][' '],dp[i][j-1]+match[' '][s2[j]]);dp[i][j]=max(dp[i][j],dp[i-1][j-1]+match[s1[i]][s2[j]]); } } printf("%d\n",dp[n][m]); } }return 0;}
0 0
- POJ 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- poj 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- Poj 1080 Human Gene Functions
- poj 1080 Human Gene Functions
- poj 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- poj 1080 human gene functions
- POJ 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- POJ-1080-Human Gene Functions
- POJ 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- poj 1080 Human Gene Functions
- poj 1080 Human Gene Functions
- POJ 1080 Human Gene Functions
- java使用Comparator与Comparable接口对对象排序
- XDOJ1144 - 组合数学三之棋魂
- 产品管理--用户研究
- android使用声音池播放声音
- IIS 6.0 升级为 IIS7.0 后 Web.Config的修改
- poj 1080 Human Gene Functions
- POJ2723——Get Luffy Out
- 物理层
- 每分钟的SYSSTAT汇总统计
- l另外一种侧滑菜单MenuDrawerDemo
- Java IO最详解
- [LeetCode] Distinct Subsequences
- 原码,反码和补码
- poj 1159 Palindrome