poj 1080 Human Gene Functions

SWD、JTAG协议和JLINK、STLINK仿真器 在1990年IEEE觉得一切妥当,于是发布了IEEE Standard 1149.1-1990,并命名为Standard Test Access Port and Boundary-ScanArchitecture,这就是大名鼎鼎的JTAG了。开发工程师通过结合使用RealView MDK的调试器和ULINK2,可以方便的在目标硬件上进行片上调试(使用on-chip JTAG,SWD和OCDS)、Flash编程。,是ARM设计的协议,用于对其微控制器进行编程和调试。情况下,SWD整体性能比JTAG更好。 阅读详情
Human Gene Functions
--------------------

Time Limit: 1000MS		Memory Limit: 10000K
Total Submissions: 18536		Accepted: 10295

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 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 – 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 –GT--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 file. 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 

Sample Output

14
21 



```
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int a,b,c,d,n,m;
int dp[116][116];
char s1[116];
char s2[116];
int arr1[116];
int arr2[116];
int sco[6][6]={0,0,0,0,0,0,
                        0,5,-1,-2,-1,-3,
                        0,-1,5,-3,-2,-4,
                        0,-2,-3,5,-2,-2,
                        0,-1,-2,-2,5,-1,
                        0,-3,-4,-2,-1,0};
int main()
{
        int t;
        cin>>t;
        while(t--)
        {
                scanf("%d%s%d%s",&n,s1,&m,s2);
                for (int i=1;i<=n;i++)
                {
                        int j=i-1;
                        if (s1[j]=='A')
                                arr1[i]=1;
                        else if (s1[j]=='C')
                                arr1[i]=2;
                        else if (s1[j]=='G')
                                arr1[i]=3;
                        else if (s1[j]=='T')
                                arr1[i]=4;
                }
                for (int i=1;i<=m;i++)
                {
                        int j=i-1;
                        if (s2[j]=='A')
                                arr2[i]=1;
                        else if (s2[j]=='C')
                                arr2[i]=2;
                        else if (s2[j]=='G')
                                arr2[i]=3;
                        else if (s2[j]=='T')
                                arr2[i]=4;
                }
            

                /*INITS*/
                for (int i=1;i<=n+10;i++)
                        for (int j=1;j<=m+10;j++)
                                dp[i][j]=-99999999;
                dp[1][0]=sco[arr1[1]][5];
                dp[0][1]=sco[5][arr2[1]];
                dp[0][0]=0;
                for (int i=2;i<=n;i++)
                {
                        dp[i][0]=dp[i-1][0]+sco[arr1[i]][5];
                }
                for (int i=2;i<=m;i++)
                        dp[0][i]=dp[0][i-1]+sco[5][arr2[i]];



                for (int i=0;i<=n;i++)
                        for (int j=0;j<=m;j++)
                        {
                                dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+sco[arr1[i+1]][arr2[j+1]]);
                                dp[i+1][j]=max(dp[i+1][j],dp[i][j]+sco[arr1[i+1]][5]);
                                dp[i][j+1]=max(dp[i][j+1],dp[i][j]+sco[5][arr2[j+1]]);
                        }
               cout<<dp[n][m]<<endl;
        }
JTAG 、 SWD 和 J-Link、ST-Link STLINK有多个版本,分别是ST-LINK/V1(已停产),ST-LINK/V2(常见于Nucleo或Discovery开发板),ST-LINK/V2-1(常见于新版Nucleo或Discovery开发板),ST-LINK/V3(最新版)。JLink是通用型的ARM内核芯片仿真器,支持的芯片和软件开发环境多 ,IAR,Keil MDK, STM32 cudeIDE,MCUXpresso IDE(GCC+Eclipse)针对NXP芯片;支持开发环境,IAR,keil MDK,STM32 cudeIDE, 阅读详情

相关推荐

开发环境 之八 详解 JTAG、SWD 接口

JTAG 和 SWD 在嵌入式开发中可以说是随处可见,他们通常被用来配合 J-Link 、ULINK、ST-LINK 等仿真器在线调试嵌入式程序。此外,还有飞思卡尔芯片中的 Background debug mode(BDM) 接口,Atmel 芯片中的 debugWIRE ;Nexus 5001 论坛制定的全球嵌入式处理器调试接口标准 IEEE-ISTO 5001。

技术干货 1万+

hdu1080 Human Gene Functions(LCS变形)

Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1338Accepted Submission(s): 767 Problem Description It is well ...

angtongyou1893的博客 295

建议收藏:华为海思IC设计笔试题,含解析(附下载)

接触过的部门有麒麟芯片、CPU/GPU,总体面试感觉非常好,规范且认真,第一轮手撕代码状态机+复盘机考题+瞄准几个知识点深挖,时间1hour+;一二轮面试是连着的,所以很累。但是岗位就那么多,在面试的时候,很多同学因为准备不充分,与岗位失之交臂,无缘进入该公司。时序电路有记忆功能,不会产生锁存器,锁存器一般在组合逻辑中case写不全,else写不全,或者敏感列表写不全。

nuoweishizi的博客 3285

Human Gene Functions(dp)

题目描述 众所周知,人类基因可以认为是一个基因序列,包含四种核苷酸,分别用A,C,T和G四个字母简单地表示。生物学家对鉴别人类基因并确定他们的功能很感兴趣,因为这对诊断人类疾病和开发新药很有用。…… 你的任务是编写一个程序,按以下规则比较两个基因并确定它们的相似程度。 给出两个基因AGTGATG和GTTAG,他们有多相似呢?测量两个基因相似度的一种方法称为对齐。使用对齐方法,可以在基因的适当位置插进空格,让两个基因的长度相等,然后根据基因分值矩阵计算分数。 例如,给AGTGATG插入一个空格,就得到AGT

qq_51772871的博客 822

嵌入式存储进阶:除了KV存储,EasyFlash的IAP和LOG功能怎么玩?

本文深入探讨了嵌入式存储方案EasyFlash的高级功能,包括在线固件升级(IAP)和闪存日志存储(LOG)。通过详细解析IAP的双区备份设计和LOG的环形缓冲区架构,提供硬件适配、安全升级流程和日志管理技巧等实战指南,帮助开发者在物联网设备中实现可靠的数据存储和固件更新。

weixin_29280219的博客 413

Comsol固体力学仿真﹣﹣受均匀内压的厚壁球壳弹塑性分析(加载卸载全流程)

COMSOL固体力学及结构力学仿真较少,故而查询了有关资料,才建立了如下模型。图4 加载卸载全历程中的冯米塞斯应力变化。该有限元模型是通过扫掠而得的结构化网格。图2 加载卸载全历程中的塑型区域变化。图3 加载卸载全历程中的位移应力变化。图6 关键节点第一,第三主应力分布。图5 关键节点应力场与塑性区分布。《弹塑性力学》大作业,记录一下。图1 球体的有限元网格模型。

weixin_62236383的博客 1484

POJ 1080 Human Gene Functions

/*********************************** Problem: POJ 1080 Human Gene Functions Time: 0MS Memory: 176K Accepted Time: 2009-08-07 16:05:15 Tip: 做过的题也不会做了 郁闷 http://hi.baidu.com/fandywang_jlu/blog/item/20...

万猫学社 8399

手把手教你学simulink实例--基于Simulink的航空发动机控制系统设计与仿真

航空发动机是飞机的核心动力装置,其性能直接影响飞行器的安全性、经济性和可靠性。现代航空发动机控制系统需要具备高精度、快速响应和强鲁棒性的特点,以适应复杂的飞行环境和任务需求。本项目旨在使用MATLAB/Simulink平台,设计并实现一种适用于涡扇发动机的闭环控制系统,通过调节燃油流量、压气机叶片角度等控制变量,确保发动机在不同工况下稳定运行,并满足推力需求。

MHD0815的博客 275

【dp】POJ - 1080 Human Gene Functions

【dp】POJ - 1080 Human Gene Functions【poj链接】 【vj链接】题目大意给两个字符串包括A,C,G,T,一一对应的组合有权重,加入’-‘使两字符串长度相等,求最大权重和,注意:两个’-‘不可对应。 InputThe input consists of T test cases. The number of test cases ) (T is given in

xuziling_的博客 203

开心消消乐

1)当点击一个1时,该1变被反转为0,同时相邻的上、下、左、右,以及左上、左下、右上、右下8个方向的1(如果存在1)均会自动反转为0;2)进一步地,一个位置上的1被反转为0时,与其相邻的8个方向的1(如果存在1)均会自动反转为0;上述样例中,四个角上的1均在中间的1的相邻8个方向上,因此只需要点击一次即可。给定一个N行M列的二维矩阵,矩阵中每个位置的数字取值为0或1。在上述4 * 4的矩阵中,只需要点击2次,即可将所有的1进行消除。接下来N行表示矩阵的初始值,每行均为M个数,取值范围[0,1]

面试高手的博客 2728

MTK Android 12 Clone Project 克隆项目

本文介绍了如何使用MTK Android 12 Clone Project 克隆一个新的项目。通过使用绝对路径执行Perl脚本,并根据需要选择升级或降级位数,可以成功地生成一个新的项目并进行编译。希望本文对xdm有所帮助。

我其实什么都不会 942

POJ 1080 Human Gene Functions(字符串匹配得分,dp)

题目链接; POJ 1080 Human Gene Functions 题意: 给出两个长度不超过100100,且只含字母A,G,C,TA,G,C,T的字符串,需要将两个字符串匹配得分,每个字母可以和空格对应,得分规则如下: 求最大得分。 分析: 这道题和之前做过的UVAL ive 6697 Homework Evaluation很类(yi)似(yang)。 dp[i][j][0

ramay7 604

VR大空间开发前期,设备选项与流程

欢迎开发者加入 VR 大空间开发之旅!本系列教程将以 Pico 和 HTC 设备为核心,系统拆解从基础搭建到功能实现的全流程,助你快速掌握开发要点。本系列共 12 篇,专为有编程基础但缺乏大空间开发经验的开发者设计。前 7 篇针对 Pico 和 HTC 设备差异分别讲解,后续步骤通用。核心目录如下:​1. 空间环境要求 - 灯光设置 - 场地面积规划 - 识别图案设计2. 网络部署方案3. 客户端体验模式解析 - 一体机模式 - 云渲染模式 - 背包体验模式4. Pico空间录制方法

unitygroup的博客 1347

Human Gene Functions [POJ-1080]

这个题的算法类似最长公共子序列的算法。 分别用a, b来储存字符串, f[i][j] 是将a[i] 以及 b[j]之前的两个字符串变成同样长的串对应的最大值。而 f[i][j] 可能从三种状态转移过来: f[i][j - 1] + b[j] 与 ‘-’对应的值。 f[i - 1][j] + a[i] 与‘-’ 对应的值。 f[i - 1][j - 1] + a[i] 与 b[j] 对应的值。 ...

qq_45904666的博客 484

Openclaw第3章:进阶部署

本章面向需要在特定环境中稳定运行 OpenClaw 的用户,介绍 Windows、Linux、Docker 以及 Cloudflare Workers 四种进阶部署方式。每种方式各有侧重:Windows 部署适合桌面用户日常使用,Linux 部署适合开发者,Docker 部署适合追求环境隔离的运维场景,Cloudflare Workers 部署则适合希望获得全球边缘网络加速的用户。读者可根据自身环境和需求选择合适的方案,完成本章后可继续阅读第4章了解维护升级流程。

Maynor的博客 1292

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

POJ 1080 Human Gene Functions(LCS变形)

POJ 1080 Human Gene Functions题目大意 求两基因的相似度,可以在每个基因对中加入若干空格,每个字母与其他字母或自身和空格对应都有一个打分,则相似度就是最大的得分和 分析LCS变形,我采用的是递归的写法 dp[i][j]表示第一串前i个字符,第二串前j个字符匹配所能得到的最大分数和。状态和状态的转移都类似于最长公共子序列问题(LCS)只是字符和字符匹配的分数不是固定的

AIDreamer 366

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

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

【动态规划】POJ 1080 Human Gene Functions

这段时间要沉迷刷题一段时间了,就让优快云陪我一起吧! 一、题目大意 这个题目的大致意思就是,给你两个字符串,每个字符串是由’A’、‘C’、‘G’、‘T’四个字符组成(长度不超过100),可以在两个字符串中的任意位置增添任意的’-’,但增添后必须保证其长度相等,然后对应位置上的两个字符可以根据表去查找其对应的分数,把所有位置的分数相加,即得到最终的总分,题目要求求得总分的最大值。 二、题目思路...

Johnson的博客 174

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

POJ-1080-Human Gene Functions

POJ-1080 ACM

上千主上-贝库塔 638

【POJ1080】【Human Gene Functions】

Human Gene Functions Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17996   Accepted: 10004 Description It is well known that a human gene can be co

ACM之路 386

poj1080 - Human Gene Functions

想看更多的解题报告: http://blog.youkuaiyun.com/wangjian8006/article/details/7870410                                      转载请注明出处:http://blog.youkuaiyun.com/wangjian8006 题目大意:给出两个字符串,要使他们对齐,比如: AGTGATG GTTAG 这两个字符串可以

贰圣 2535

POJ 1080 Human Gene Functions(求两字符串相似度:LCS变形)

POJ 1080 Human Gene Functions(求两字符串相似度:LCS变形) http://poj.org/problem?id=1080 题意: 给你两个由字符A,C,G,T构造的字符串s1和s2, 现在你可以在这两个字符串中插入空格, 使得两串长相等(但是不能使得s1的空格对应s2的空格位置). 然后给你s1的特定字符对应s2中特定字符所能获得的分数矩阵: 问你最后两个字符串所能获得的最大分数是多少? 分析: 本题很类似于求字符串最短编辑距离或者求

code 1315

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 h

Vision 315

POJ 1080, Human Gene Functions

Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 8125Accepted: 4497 DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which ar...

weixin_34252686的博客 653

POJ-1080:Human Gene Functions

题目:Human Gene FunctionsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 20239 Accepted: 11299DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four ...

AlphaWA的博客 363
上一篇: POJ - 2676 Sudoku 题解
下一篇: poj3252 Round Numbers
WilliamCode
博客等级 码龄11年 118粉丝 105原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值