(简单dp) poj 3356 AGTC

pku acm 3356 AGTC Java代码 pku acm 第3356题 AGTC Java代码,有详细的注释,动态规划 立即下载
AGTC
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 5058 Accepted: 1953

Description

Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below:

 

  • Deletion: a letter in x is missing in y at a corresponding position.
  • Insertion: a letter in y is missing in x at a corresponding position.
  • Change: letters at corresponding positions are distinct

 

Certainly, we would like to minimize the number of all possible operations.

Illustration

 

A G T A A G T * A G G C

| | | | | | |
A G T * C * T G A C G C

 

Deletion: * in the bottom line
Insertion: * in the top line
Change: when the letters at the top and bottom are distinct

This tells us that to transform x = AGTCTGACGC into y = AGTAAGTAGGC we would be required to perform 5 operations (2 changes, 2 deletions and 1 insertion). If we want to minimize the number operations, we should do it like

 

A  G  T  A  A  G  T  A  G  G  C

| | | | | | |
A G T C T G * A C G C

 

and 4 moves would be required (3 changes and 1 deletion).

In this problem we would always consider strings x and y to be fixed, such that the number of letters in x is m and the number of letters in y is n where n ≥ m.

Assign 1 as the cost of an operation performed. Otherwise, assign 0 if there is no operation performed.

Write a program that would minimize the number of possible operations to transform any string x into a string y.

Input

The input consists of the strings x and y prefixed by their respective lengths, which are within 1000.

Output

An integer representing the minimum number of possible operations to transform any string x into a string y.

Sample Input

10 AGTCTGACGC
11 AGTAAGTAGGC

Sample Output

4
 
FPGA波束形成:从算法到硬件的艺术之旅 本文深入探讨了FPGA在波束形成技术中的应用,从算法原理到Verilog硬件实现的全过程。文章详细分析了FPGA并行处理、低延迟和可重构特性如何优化波束形成系统性能,并提供了Verilog关键模块代码示例和资源优化策略,为工程师实现高效FPGA波束形成解决方案提供实用指导。 阅读详情

相关推荐

工作:三菱PLC与伺服之CC-Link IE Field Network通讯应用

CC-LINK-IE

好记性不如烂笔头 2万+

poj 3356 编辑距离(空间优化)

AGTC Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7780   Accepted: 3087 Description Let x and y be two strings over some finite alphabet A. We would lik

keynumber的专栏 1423

告别裸机:在FreeRTOS上为STM32移植SOEM 1.4.0的完整指南

本文详细介绍了在FreeRTOS环境下为STM32H7系列芯片移植SOEM 1.4.0的完整指南,涵盖环境准备、任务架构设计、OSAL层适配及网络驱动优化等关键步骤。通过EtherCAT主站解决方案的实现,帮助开发者构建稳定可靠的工业自动化系统,提升实时通信性能。

weixin_33582311的博客 368

pku 3356 AGTC

AGTC Time Limit:1000MS  Memory Limit:65536KTotal Submit:1285 Accepted:395Description Input Output Sample Input Sample Output4#include iostream>#include string>using namespace std

liyanguestc的专栏 1005

FLUX.1 LoRa 微调

微调的好处:可以让你突破换脸这种输入图片的场景约束,微调好的模型可以让你真正的文生图。换脸只能根据输入的图片和视频来生成内容。

szmars的博客 3623

【学习笔记】人群归因分数 PAF 以及combined PAF

人群归因风险比例(Population Attributable Fraction,PAF)是一个流行病学指标,它估计了在总体中,如果能消除一个特定的危险因素,能预防多少百分比的疾病或健康结果。简单来说,PAF回答的是:“如果没有这个风险因素,总体中会有多少病例是可以避免的?

weixin_53499537的博客 4915

POJ 3356 AGTC(最长公共子序列)

AGTC Description Letxandybe two strings over some finite alphabetA. We would like to transformxintoyallowing only operations given below: Deletion:a letter inxis missing...

weixin_30621919的博客 221

S32K3基于EB配置GPT触发WDG的实战解析

本文详细解析了S32K3 MCU基于EB tresos工具配置GPT定时器触发看门狗(WDG)的实战方法。通过分析协同工作机制、MCAL配置步骤及代码实现,帮助开发者构建可靠的硬件监控系统,提升汽车电子系统的安全性与实时性。

f9g0h的博客 207

poj 3356

Description Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below: Deletion: a letter in x is missing in y...

weixin_34273479的博客 156

银河麒麟V10ServerSP3中安装Nacos2.4.x详细教程

银河麒麟V10ServerSP3中安装Nacos2.4.x详细教程

yuanjinshenglife的专栏 1307

Uncertainty-Aware Mean Teacher(UA-MT)

本文提出了一种新的基于不确定性的半监督学习框架(UA-MT),通过额外利用未标记的数据从3D MR图像中分割左心房。具体地说,本文建立了一个教师模型和一个学生模型,学生模型通过最小化标注数据上的分割监督损失和所有输入数据上的与教师模型预测输出的一致性损失进行优化。如果没有未标记输入中的注释,教师模型的预测目标可能不可靠且有噪声。:在估计不确定性 U 的指导下,我们过滤掉相对不可靠**(高不确定性),整个体积** U 的不确定性**是 {u} ∈ RH×W ×D。过滤掉高不确定性的,也就是熵大于某个值的。

Alexa_的博客 1876

poj 3356 AGTC 简单dp

//poj 3356 //sep9 #include using namespace std; const int MAXN=1024; char a[MAXN],b[MAXN]; int dp[MAXN][MAXN]; int main() { int lenA,lenB; while(scanf("%d%s%d%s",&lenA,&a[1],&lenB,&b[1])!=EOF){

sepNINE的专栏 488

AIGC实战——多模态模型DALL.E 2

DALL.E 2 是 OpenAI 提出的一个大规模文本生成图像模型,可以根据文本提示生成各种风格的逼真图像。它通过将预训练模型 CLIP 与 GLIDE 中的扩散模型架构相结合完成任务。它还具有其他应用,例如通过文本提示编辑图像和提供给定图像的变体。虽然它也有一些局限性,例如不一致的文本渲染和属性绑定,但 DALL.E 2 是仍然一个非常强大的AI模型,推动了生成模型的发展。

盼小辉丶的博客 1万+

POJ 3356 AGTC

POJ 3356 AGTC(最小编辑距离) 前辈原博客:https://blog.csdn.net/u013480600/article/details/40780781 http://poj.org/problem?id=3356 题意: 给出两个字符串x 与 y,其中x的长度为n,y的长度为m,并且m>=n.然后y可以经过删除一个字母,添加一个字母,转换一个字母,三种操作得到x.问...

Happye0101的博客 266

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

AGTC POJ - 3356(字符串DP)

Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below: Deletion: a letter in x is missing in y at a corresponding position. I...

tomjobs的博客 889

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

POJ 3356 AGTC(最小编辑距离)

POJ 3356 AGTC(最小编辑距离) http://poj.org/problem?id=3356 题意: 给出两个字符串x 与 y,其中x的长度为n,y的长度为m,并且m>=n.然后y可以经过删除一个字母,添加一个字母,转换一个字母,三种操作得到x.问最少可以经过多少次操作 分析: 我们令dp[i][j]==x表示源串的前i个字符变成目串的前j个字符需要x步操作. 初始化: dp[0][i]==i且 dp[i][0]=i. 上述前者表示添加源串

code 1843

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

poj 3356 AGTC(dp,最小编辑距离)

poj 3356 AGTC D(0, 0) = 0 D(i, 0) = insertCost * i D(0, j) = deleteCost * j D(i-1, j) + insertCost( targeti) D(i, j) = min D(i-1, j-1) + substituteCost( sourcej, targeti)  D(i, j-1) + dele

yjCola 743

AGTC POJ - 3356

一、内容 Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below: Deletion: a letter in x is missing in y at a corresponding p...

Tizzi的博客 678

DP(最短编辑距离)-AGTC POJ - 3356

DP(最短编辑距离)-AGTC POJ - 3356 题意: 给定两个长度分别为n和m的字符串a和b,允许进行3种操作:删除、插入,修改。求最少操作步骤,使得a与b相同。给定两个长度分别为n和m的字符串a和b,允许进行3种操作:删除、插入,修改。\\求最少操作步骤,使得a与b相同。给定两个长度分别为n和m的字符串a和b,允许进行3种操作:删除、插入,修改。求最少操作步骤,使得a与b相同。 Samp...

njuptACMcxk的博客 265

poj3356 AGTC dp把一个字符串经过最少步数转为另一个字符串

AGTC Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7371   Accepted: 2931 Description Let x and y be two strings over some finite alphabet A. We would like

Shirley 4199

POJ 3356 AGTC 解题报告(Edit Distance,DP)

AGTC Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9579   Accepted: 3659 Description Let x and y be two strings over some finite alphabet A. We would lik

SF-_- 的 ACM 博客 1071

POJ3356- AGTC(dp)

Description: Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below: Deletion: a letter in x is missing in y at a correspondi...

weixin_43880485的博客 349

poj 3356 AGTC

/* Name: poj 3356 AGTC Author: UnimenSun Date: 17/05/2011 16:25 Description: LCS变形*//*解题报告:LCS的变形要求结果 = 串2的长度 - 两串的LCS*/#include #include #include #include using namesp

Unimen的专栏 446

poj3356 AGTC 解题心得

原题: Description Letxandybe two strings over some finite alphabetA. We would like to transformxintoyallowing only operations given below: Deletion:a letter inxis missing ...

advyne9986的博客 170

poj 3356 AGTC(线性dp)

题目链接:http://poj.org/problem?id=3356 思路分析:题目为经典的编辑距离问题,其实质为动态规划问题; 编辑距离问题定义:给定一个字符串source,可以对其进行复制,替换,删除,增加操作,另外根据具体情况已经规定了每种操作的cost,现在要求求出一个操作序列,使其变为一个给定的字符串dest,并且该操作序列的cost的和最小(在该题目中复制开销为0,其他...

aqjh9999的博客 132

POJ3356 AGTC DP

http://poj.org/problem?id=3356

u014445884的专栏 522
上一篇: (最大流) poj 1459 Power Network
下一篇: (有限物品背包问题) poj 1276 Cash Machine
Hashmat
博客等级 码龄16年 14粉丝 62原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值