栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

ZCMU--1425: Careless Tony(C语言)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ZCMU--1425: Careless Tony(C语言)

Description

Tony is such a careless typist that he finds himself making mistakes AGAIN. What's worse, the cursor key is not working so that he can only use the backspace key to reach the place where the mistake is, and then type whatever he's deleted on the way AGAIN :(

Now let's help Tony find out at least how long it will cost him to correct his mistake.

Input

The first line of input contains an integer N, which is the number of test cases. Then N test cases follow.

Each test case consists of 3 lines of input:

the 1st line contains a positive integer t (<= 100), which is the time taken for Tony to delete/input a character;

the 2nd line contains the correct content of text;

and the 3rd line contains the text typed by Tony.

Note: The text contents contain only the readable characters. The total length of each text is no longer than 80 characters.

Output

For each test case, print in one line the minimal time taken for Tony to correct his mistake.

Sample Input 2 1 WishingBone WashingBone 1 Oops Oooops Sample Output 20 6 解析:我们肯定删除到第一个不同的位置,然后再重新打字,因此我们找到第一个不同的位置,然后计算我们需要删除几个字符,需要重新打入几个字符,最后乘上单个操作的时间即可。
#include 
#include 
char a[85],b[85];
int main()
{
	int n,t,len1,i,m,len2;	
	scanf("%d",&n);
	while(n--){
		scanf("%d",&l);
		scanf("%s%s",a,b);
		len1=strlen(a),len2=strlen(b);
		m=0;	//初始化需要校对的a[]的位置 
		for(i=0;i 
 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/850255.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号