【Hdu】1080 Human Gene Functions
来源:互联网 发布:电气专业单词软件下载 编辑:程序博客网 时间:2024/05/17 04:56
#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;//A:0 C:1 G:2 T:3 -:4const int g[5][5]={ 5,-1,-2,-1,-3, -1, 5,-3,-2,-4, -2,-3, 5,-2,-2, -1,-2,-2, 5,-1, -3,-4,-2,-1,-1121};const int L=120;const int M=-100000000;char s[L],t[L]; int ls,lt;int cs[L],ct[L],f[L][L]; inline int find(char a){ if (a=='A') return 0; if (a=='C') return 1; if (a=='G') return 2; if (a=='T') return 3; return 4;}inline int max(int i,int j){ return i>j?i:j;}int main(void){ int cas; scanf("%d",&cas); for (int cc=1;cc<=cas;cc++) { scanf("%d%s%d%s",&ls,&s[1],<,&t[1]); for (int i=1;i<=ls;i++) cs[i]=find(s[i]); for (int i=1;i<=lt;i++) ct[i]=find(t[i]); for (int i=0;i<=ls;i++) for (int j=0;j<=lt;j++) f[i][j]=M; f[0][0]=0; for (int i=1;i<=ls;i++) f[i][0]=f[i-1][0]+g[cs[i]][4]; for (int j=1;j<=lt;j++) f[0][j]=f[0][j-1]+g[4][ct[j]]; for (int i=1;i<=ls;i++) for (int j=1;j<=lt;j++) { f[i][j]=max(f[i-1][j]+g[cs[i]][4],f[i][j-1]+g[4][ct[j]]); f[i][j]=max(f[i][j],f[i-1][j-1]+g[cs[i]][ct[j]]); } printf("%d\n",f[ls][lt]); } return 0;}
0 0
- hdu 1080 Human Gene Functions
- HDU 1080 Human Gene Functions
- HDU 1080 Human Gene Functions
- 【Hdu】1080 Human Gene Functions
- HDU 1080 Human Gene Functions
- hdu 1080 Human Gene Functions
- hdu 1080 Human Gene Functions
- hdu-1080 Human Gene Functions
- hdu 1080 Human Gene Functions
- hdu 1080 Human Gene Functions
- hdu 1080 Human Gene Functions
- hdu Human Gene Functions
- HDU Human Gene Functions
- hdu 1080 ;poj 1080 Human Gene Functions
- hdu 1080 Human Gene Functions--DP
- HDU 1080 || ZOJ 1027 Human Gene Functions
- hdu 1080 Human Gene Functions(dp)
- HDU 1080 Human Gene Functions dp
- 数据库性能优化二:数据库表优化
- PSSM特征-从生成到处理
- Android TextView内容过长加省略号
- Java&Scala混合编程
- Qt中main函数详解
- 【Hdu】1080 Human Gene Functions
- 数据库性能优化三:程序操作优化
- DicomIoException: Requested 132 bytes past end of fixed length stream.
- bootstrap-table(三)
- 设置mysql中自增列的初始值和增加步长
- Unix网络编程中第一个例子出现connect error: Connection refused
- Material Designer的低版本兼容实现(五)—— ActivityOptionsCompat
- SQL索引一步到位
- 每天一个linux命令(6):rmdir 命令