ZOJ -027动态规划解答方法

3DMax高效建模与人工智能:一场颠覆传统创作的效率革命 AI与3DMax的结合,不仅是工具效率的升级,更是一场创作范式的革命。从“手动雕刻”到“智能共生”,设计师的角色正从执行者转向决策者。正如网友所言:“AI不是替代人类,而是赋予凡人以神笔。”在这场变革中,唯有拥抱技术、深耕创意,方能在数字艺术的浪潮中立于潮头。参考文献与工具推荐技术原理:火星时代资讯《人工智能和三维建模》工具实测:哔哩哔哩《tyDiffusion 3dsMax应用》9、Tripo AI官网教育案例:原创论文《人工智能技术介入三维动画课程建设》 阅读详情

   http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1027

Human Gene Functions

Time Limit: 2 Seconds Memory Limit: 65536 KB

It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identifying human genes and determining their functions, because these can be used to diagnose human diseases and to design new drugs for them.

A human gene can be identified through a series of time-consuming biological experiments, often with the help of computer programs. Once a sequence of a gene is obtained, the next job is to determine its function. One of the methods for biologists to use in determining the function of a new gene sequence that they have just identified is to search a database with the new gene as a query. The database to be searched stores many gene sequences and their functions �C many researchers have been submitting their genes and functions to the database and the database is freely accessible through the Internet.

A database search will return a list of gene sequences from the database that are similar to the query gene. Biologists assume that sequence similarity often implies functional similarity. So, the function of the new gene might be one of the functions that the genes from the list have. To exactly determine which one is the right one another series of biological experiments will be needed.

Your job is to make a program that compares two genes and determines their similarity as explained below. Your program may be used as a part of the database search if you can provide an efficient one.

Given two genes AGTGATG and GTTAG, how similar are they? One of the methods to measure the similarity of two genes is called alignment. In an alignment, spaces are inserted, if necessary, in appropriate positions of the genes to make them equally long and score the resulting genes according to a scoring matrix.

For example, one space is inserted into AGTGATG to result in AGTGAT-G, and three spaces are inserted into GTTAG to result in �CGT--TAG. A space is denoted by a minus sign (-). The two genes are now of equal length. These two strings are aligned:

AGTGAT-G
-GT--TAG

In this alignment, there are four matches, namely, G in the second position, T in the third, T in the sixth, and G in the eighth. Each pair of aligned characters is assigned a score according to the following scoring matrix.

* denotes that a space-space match is not allowed. The score of the alignment above is (-3)+5+5+(-2)+(-3)+5+(-3)+5=9.

Of course, many other alignments are possible. One is shown below (a different number of spaces are inserted into different positions):

AGTGATG
-GTTA-G

This alignment gives a score of (-3)+5+5+(-2)+5+(-1) +5=14. So, this one is better than the previous one. As a matter of fact, this one is optimal since no other alignment can have a higher score. So, it is said that the similarity of the two genes is 14.


Input

The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case consists of two lines: each line contains an integer, the length of a gene, followed by a gene sequence. The length of each gene sequence is at least one and does not exceed 100.


Output

The output should print the similarity of each test case, one per line.


Sample Input

2
7 AGTGATG
5 GTTAG
7 AGCTATT
9 AGCTTTAAA


Output for the Sample Input

14
21 


参考答案:

#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef struct {
	int n;
	string gen;
}seq ;
int d[101][101];
int mat[150][150];
void init()
{

	 memset(mat,0,sizeof(mat));
	mat['A']['A'] = mat['C']['C'] = 5;
    mat['G']['G'] = mat['T']['T'] = 5;
    mat['A']['C'] = mat['C']['A'] = -1 ;
    mat['A']['G'] = mat['G']['A'] = -2 ;
    mat['A']['T'] = mat['T']['A'] = -1 ;
    mat['A']['-'] = mat['-']['A'] = -3 ;
    mat['C']['G'] = mat['G']['C'] = -3 ;
    mat['C']['T'] = mat['T']['C'] = -2 ;
    mat['C']['-'] = mat['-']['C'] = -4 ;
    mat['G']['T'] = mat['T']['G'] = -2 ;
    mat['G']['-'] = mat['-']['G'] = -2 ;
    mat['T']['-'] = mat['-']['T'] = -1 ;

	
}
int max(int a,int b,int c)
{
	 int x;
	 if(a>=b) x=a;
	 else x=b;
	 if(c>=x)  return c;
	 else return x;
}
// 用状态变量d[i,j]表示第一个串中长度为i和第二个串中长度为j的gene的最优解

int  main()
{
     	 init();
		 int n;
		 seq g[10];
		 cin>>n;//case个数
		   
		 for(int i=0;i<n;i++)
		 {
			 for(int j=0;j<2;j++)
			 {
				 	 cin>>g[j].n>>g[j].gen;
			 }
			  memset(d,0,sizeof(d));
			 //初始化 d[][]
			 for(int i=1;i<g[0].n;i++)
			 { 
				 d[i][0]=mat[g[0].gen[i-1]]['-']+d[i-1][0];
			 }
		     for(int i=1;i<g[1].n;i++)
			 { 
				 d[0][i]=mat[g[1].gen[i-1]]['-']+d[0][i-1];
			 }

			 for(int i=1;i<=g[0].n;i++)
			 {
				  for(int j=1;j<=g[1].n;j++)
				  {
					   int a=d[i-1][j-1]+mat[g[0].gen[i-1]][g[1].gen[j-1]];
					   int b=d[i-1][j]+mat['-'][g[0].gen[i-1]];
					   int c=d[i][j-1]+mat['-'][g[1].gen[j-1]];
					   d[i][j]=max(a,b,c);
				  }
				 
			 }
		 
			 cout<<d[g[0].n][g[1].n]<<endl;
		 }
			 return 0;
 }                                                                                                                                                         



注意:1 输出严格按照格式 2 状态数组 初始化   3 memset()  要加上<string.h>     4 数组下标可以用字符串的形式  5 动态规划问题状态转移方程的书写  

2024阅读AOSP源码的正确打开姿势 在Android系统开发中,阅读AOSP(Android Open Source Project)源码是非常重要的环节。然而,如何构建一个优雅的阅读环境却是一个不容忽视的问题。本文将介绍不同工具和方法下阅读AOSP源码的正确姿势,并对比其优缺点。 阅读详情

相关推荐

Win10蓝屏代码critical process died的解决方法

critical process died”蓝屏错误是Win10操作系统中较为常见的问题之一。当遇到这一问题时,可以尝试通过修复当前系统、检查硬盘槽位或重新安装系统等方法来解决。本文详细介绍了这三种方法的操作步骤和注意事项,希望能帮助大家摆脱这一困扰。同时,也建议大家在日常使用中注意系统的维护和更新,以减少类似问题的发生。

mmoo_python的博客 9546

求两个DNA序列的最长公共子序列

新冠状病毒的基因序列 2019年12月下旬,武汉出现了多例不明原因的病毒性肺炎病例。之后,中国疾病预防控制中心确定此次致病的病原体为一种新的冠状病毒。1月12日,世界卫生组织将其命名为“2019新型冠状病毒(2019-nCoV)”。为了弄清新型冠状病毒的起源,中国疾控中心等机构的研究人员对住院患者的样本进行高通量测序,获得了完整和部分的2019-nCoV基因组序列。接着对这些2019-nCoV基因...

qq_45013991的博客 2457

WSL中使用VMD图形化界面

【代码】WSL中使用VMD图形化界面。

handsome213的博客 846

动态规划PTA总结

数字三角形;最长公共子序列;单调递增最长子序列;最大子段和;最大矩阵和问题

罗马尼亚硬拉 1178

别再到处找了!GWAS数据下载保姆级指南:从IEU、FinnGen到UK Biobank一站搞定

本文提供GWAS数据下载的全面指南,涵盖IEU OpenGWAS、FinnGen、UK Biobank等五大核心数据库的获取策略。从数据库选型到实战操作,详细解析数据搜索、下载、预处理全流程,帮助科研人员高效获取GWAS数据,特别适合初学者快速上手。

weixin_42523543的博客 1604

项目经理必看:如何建立高效的相关方沟通机制?

你是否遇到过这样的场景?客户突然说“这不是我要的”,开发团队抱怨“需求总变”,高层追问“进度滞后为什么不早说”?这些问题的根源往往是——相关方沟通机制失效。本文聚焦“如何建立高效沟通机制”,覆盖从识别相关方到持续优化的全流程,适用于IT、产品、工程等各类项目。本文将按“理解问题→拆解核心概念→掌握工具方法→实战落地→未来趋势”的逻辑展开,重点讲解“相关方分析矩阵”“沟通计划表”等实用工具,并用“组织生日派对”的案例贯穿全文,让抽象概念变得可感知。相关方识别:用“权力/利益矩阵”找对人(像派对邀请关键客人)

项目管理的博客 1298

ZOJ-1027-Human Gene Functions

这道题的AC率很高啊,有50%多,觉得有些奇怪,感觉应该在30%才对,不管了。需要说明的是这一题中使用的分值矩阵map[][]是经过我变形的,这样变形后,使用起来会更加方便,尤其是对于X对-的情况可以直接减去表示的值就是它们之间的分值,当然,相应在输入时也已经把字母变成了数字方便后面直接用做map矩阵的下标查表。这道题是很正统的DP动态规划,所以采用了标志矩阵check表示是否计算

outer of the space 1487

【GlobalMapper精品教程】038:模拟水位上升(洪水淹没分析)案例教程

基于数字高程模型 ( DEM )格网模型,实现给定水深情况下洪水淹没区的计算模型,讨论洪水淹没演进过程可视化实现的关键技术,以三维可视化方式,动态而形象地模拟在指定洪水水位下的洪水淹没演进过程。

智慧空间实验室 2895

ZOJ-1027* 基因串匹配

1027:给出两串基因判断相似度。不同的匹配关系由下表分值决定 [img]http://dl.iteye.com/upload/attachment/535585/9a593d87-3c7a-31da-bf23-80d0a97b827e.gif[/img] 两串基因串长度不一定相等。用-补齐,其中-和-不能匹配。求最大匹配分值。 如 A G T G A T G - G T ...

linest 364

GEE:本地影像上传到GEE的Assets中,并输入机器学习算法中作为特征变量

当我们在 Google Earth Engine(GEE)中应用机器学习算法时,会输入一些影像作为特征变量数据,进一步根据这些特征影像去推理未知区域的数据。但是 GEE 平台上计算特征变量的 API 函数并不是非常全面,我们希望获得更多的特征用于分类。这个时候,我们可以将本地计算的特征影像上传到 GEE 中进行后续处理。本文记录了从本地上传特征数据到 GEE 的 Assets 中的教程,用于后续在 GEE 中分类或者回归使用。本文也可作为《》一文的补充。

养乐多的博客 1739

python代码实现了一个基于图注意力网络(GAT)和长短期记忆网络(LSTM)的股票成交量预测模型

自定义数据集类:定义了类,继承自。该类用于生成股票数据的时间序列样本,每个样本包含一个长度为seq_length的时间序列和对应的目标成交量。数据加载器:使用DataLoader对数据集进行批量加载,设置批量大小为 64,并开启数据打乱功能。GAT - LSTM 模型:定义了GAT_LSTM类,继承自。该模型结合了 GAT 和 LSTM 两种神经网络:GAT 部分:使用GATConv处理全局图特征,捕获股票之间的相互关系。LSTM 部分:使用nn.LSTM处理时间序列数据,捕捉时间序列的动态变化。

huanghm88的专栏 430

ZOJ1027-Human Gene Functions

#include<stdio.h> #define max(x,y) ((x)>(y)?(x):(y)) #define NUM 101 char str1[NUM],str2[NUM]; char map[128]; int gene[NUM][NUM]; int main() { map['A'] = 0; map['C'] = 1; map['G'] =...

zjutsunny的博客 251

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

数据结构与算法分析:专题内容——动态规划2之例题讲解(代码详解+万字长文+算法导论+力扣题)

在生物应用中,经常需要比较两个(或多个)不同生物体的 DNA。一个 DNA 串由一串称为碱基(base)的分子组成,碱基有腺嘌呤、鸟嘌呤、胞嘧啶和胸腺嘧啶 4 种类型。我们用英文单词首字母表示 4 种碱基,这样就可以将一个 DNA 串表示为有限集{A,C,G,T}上的一个字符串(参见附录 C 中对字符串的定义)。例如,某种生物的 DNA 可能为Si=S_{\mathrm{i}}=Si​=ACCGGTOGAGTGCGGGAGCGGGGGGGGGGGGGGGGG 另一种生物的 DNA 可能为S2=GTCGTTC

梅见十柒的博客 1363

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

zoj 1027 简单dp

/**    一道简单的dp题,刚开始有点懵了,不知道从何处下手,感觉bfs可以做的,就是怕O(3^n)的时间复杂度会超时,后来分析了一下觉得还是以两条链已经匹配的位置作为状态点然后用dp做比较合适,然后让我没想到的是数据这么弱。。。。我还没考虑其中有条链中有 ‘-’的情况呢。。。就这么过了有点不爽。。。╮(╯▽╰)╭。。。 */ http://acm.zju.e

AC狼崽的小窝~ 683

POJ - 1080 Human Gene Functions解题报告(求最长相同子序列)

题目大意:太长的英语,我就直接读了测试样例和题目中一些可以看的。。。。好像是关于什么人类基因工程什么的, 腺嘌呤脱氧核糖核苷酸~ 每组测试实例给你两串由AGCT四个字母组成的字符串(每个字符串100字符)。 有一个得分表: 分析:说出来你们可能不相信,这个题我还没想很明白就应开始写了,然后居然写出来了。当时就是还没怎么仔细想好细节,就想,我要知道这个,就只要知道另外的几个其他的状态就好了,并

薛崇祥的博客 829

DP--ZOJ - 1027

Description It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been intere

Epsilon 1429

ZOJ 1027 Human Gene Functions (DP)

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1027题目意思:计算两个核苷酸序列的相似性。可以通过插入-符号,将两个核苷酸对应,每对核苷酸都有相应的分数。目标是求两个核苷酸序列通过对齐操作得到的最大分数。如AGTGATG和GTTAG,通过对齐AGTGATG和-GTTA-G可以得到最大分数为(-3)+5+5

老和山之子 644

ZOJ 1027 Human Gene Functions(DP)

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1027 设f[i][j]为基因1的前 i 个核苷酸与基因2的前 j 个核苷酸匹配所得的最高分数。 则 f[i][j]= max { f[i-1][j-1]+ score[i][j], //基...

weixin_33921089的博客 141

最长公共子序列专题

给定两个字符串text1和text2,返回这两个字符串的最长的长度。如果不存在,返回0。一个字符串的是指这样一个新的字符串:它是由原字符串在不改变字符的相对顺序的情况下删除某些字符(也可以不删除任何字符)后组成的新字符串。"ace""abcde""aec""abcde"两个字符串的是这两个字符串所共同拥有的子序列。3最长公共子序列是 "ace" ,它的长度为 3。3最长公共子序列是 "abc" ,它的长度为 3。0两个字符串没有公共子序列,返回 0。

weixin_62827806的博客 211

PKU1080 Human Gene Functions

/*Human Gene FunctionsTime Limit: 1000MS        Memory Limit: 10000KTotal Submissions: 6974        Accepted: 3861DescriptionIt is well known that a human gene can be considered as a sequen

zonelight的专栏 792

POJ 1080_Human Gene Functions

Description It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been intere

骐骥一跃不能十步,驽马十驾功在不舍 737

POJ 1080 Human Gene Functions(动态规划)

题目来源:POJ 1080 Human Gene Functions http://acm.pku.edu.cn/JudgeOnline/problem?id=1080 解法类型:动态规划 解题思路: 网上一份解题报告:写的很详细,就此摘来: http://nash250.blog.hexun.com/9794371_d.html 和《算法导论...

weixin_33935777的博客 178

ZOJ-1027

应该算是第一道DP,刚看完算法导论DP里面的LCS这一节,就拿这题来练练手了,基本算法差不多,稍加改动就行,只是感觉自己还没有完全理解c[i][j]这张表,可能多练练DP会加深理解吧 #include #include #include int max(int a, int b, int c) { int t = a > b ? a : b; return t > c ? t

xhldtc的专栏 507

ZOJ 1027

这是一道DP题。 初看

Lostwinder的专栏 723

ZOJ 4019 (动态规划)

题目链接:https://vjudge.net/problem/ZOJ-4019 题意 有个容量为c的背包,两类物品,其权值分别为k1、k2,第一种物品有n个,第二种有m个,每个物体都有自己的体积。当放进一个物体进入背包时,其获得的价值的对应的权值k乘上放入当前物体后剩余的容量。现在问,能够获得的最大价值是多少? 思路: 因为价值与物体放入后剩余的容量有关,所以,对于同一类物品,先放入体...

weixin_44757834的博客 264

PTA 2 新冠状病毒的基因序列(动态规划)

2019年12月下旬,武汉出现了多例不明原因的病毒性肺炎病例。之后,中国疾病预防控制中心确定此次致病的病原体为一种新的冠状病毒。1月12日,世界卫生组织将其命名为“2019新型冠状病毒(2019-nCoV)”。为了弄清新型冠状病毒的起源,中国疾控中心等机构的研究人员对住院患者的样本进行高通量测序,获得了完整和部分的2019-nCoV基因组序列。接着对这些2019-nCoV基因组和其他冠状病毒的基因组开展系统进化分析,以便确定这些病毒的进化史,帮助推断其可能的来源。 上述的研究就属于计算机和生物医学的交

我的博客 2056

zoj 1027 - Human Gene Functions

题目:计算两个DNA串的,最大权值公共子序列。

小白菜又菜 882
上一篇:
下一篇: 字符数组归并排序操作
rually
博客等级 码龄16年 68粉丝 202原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值