5590

ZYB‘s Biology

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 560    Accepted Submission(s): 413

Problem Description

After getting 600 scores in NOIP ZYB(ZJ−267) begins to work with biological questions.Now he give you a simple biological questions:
he gives you a DNA sequence and a RNA sequence,then he asks you whether the DNA sequence and the RNA sequence are 
matched.

The DNA sequence is a string consisted of A,C,G,T;The RNA sequence is a string consisted of A,C,G,U.

DNA sequence and RNA sequence are matched if and only if A matches U,T matches A,C matches G,G matches C on each position.

Input

In the first line there is the testcase T.

For each teatcase:

In the first line there is one number N.

In the next line there is a string of length N,describe the DNA sequence.

In the third line there is a string of length N,describe the RNA sequence.

1≤T≤10,1≤N≤100

Output

For each testcase,print YES or NO,describe whether the two arrays are matched.

Sample Input

2
4
ACGT
UGCA
4
ACGT
ACGU

Sample Output

YES
NO

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int N,length,a[100],b[100],i,j,k;
    char temp;
    cin>>N;
    while(N--)
    {
        cin>>length;
        for(i=0;i<length;i++)
        {

            cin>>temp;
            if(temp==‘A‘) a[i]=1;
            else if(temp==‘C‘)a[i]=2;
            else if(temp==‘G‘)a[i]=3;
            else if(temp==‘T‘)a[i]=4;
        }
        for(j=0;j<length;j++)
        {

            cin>>temp;
            if(temp==‘U‘) b[j]=1;
            else if(temp==‘G‘)b[j]=2;
            else if(temp==‘C‘)b[j]=3;
            else if(temp==‘A‘)b[j]=4;
        }
        for(k=0;k<length;k++)
        {
            if(a[k]!=b[k]) break;
        }
        if(k<length) cout<<"NO"<<endl;
        else if(k==length) cout<<"YES"<<endl;
    }
    return 0;
}
时间: 2024-08-01 23:00:52

5590的相关文章

hdu 5590 ZYB&#39;s Biology

Problem Description After getting 600 scores in NOIP ZYB(ZJ−267) begins to work with biological questions.Now he give you a simple biological questions: he gives you a DNA sequence and a RNA sequence,then he asks you whether the DNA sequence and the

HDU 5590 ZYB&#39;s Biology 水题

ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5590 Description ZYB(ZJ−267)在NOIP拿到600分之后开始虐生物题,他现在扔给你一道简单的生物题:给出一个DNA序列和一个RNA序列,问它们是否配对. DNA序列是仅由A,C,G,T组成的字符串,RNA序列是仅由A,C,G,U组成的字符串. DNA和RNA匹配当且仅当每

编译安装lamp-4(安装xcache,为php加速)

***********安装xcache,为php加速******************* unzip -o PHPMyAdmin-4.0.5-all-languages.zip mv PHPMyAdmin-4.0.5-all-languages /usr/local/apache/htdocs/pma 1,压力测试: ulimit -n 3000 ab -c 100 -n 2000 http://10.10.37.138/pma/index.php 十个并发,发两千个请求 [[email pr

最最常用的 100 个 Java 类(转)

大部分的 Java 软件开发都会使用到各种不同的库.近日我们从一万个开源的 Java 项目中进行分析,从中提取出最常用的 Java 类,这些类有来自于 Java 的标准库,也有第三方库.每个类在同一个项目中只计数一次,下面的列表中显示前 100 名的类. 以下列表中按使用最多的类进行排序,第三个数值表示 10000 个项目里使用到该类的项目数,而完整的列表请看 here. java.util.ArrayList(6958) java.io.IOException(6866) java.util.

Google Play 服务提示更新、Google play 闪退(二)

其实出现这些问题的根本原因是因为:你的Google Play 服务安装的版本不对. 其实,根据Google给出的升级notes: Uploader's notes: To figure out the right version of Google Play services for your Android device, go to Settings -> Apps -> Google Play services, and look at the last 3 numbers in the

如果用ImageButton需要使用图片

ImageView中XML属性src和background的区别: background会根据ImageView组件给定的长宽进行拉伸,而src就存放的是原图的大小,不会进行拉伸.src是图片内容(前景),bg是背景,可以同时使用. 此外:scaleType只对src起作用:bg可设置透明度,比如在ImageButton中就可以用android:scaleType控制图片的缩放方式,示例代码如下: <ImageView android:id="@+id/img" android:

zsrrtezsrrtezsrrte

www.readnovel.com/novel/13618/1.html www.readnovel.com/novel/13618/2.html www.readnovel.com/novel/13618/3.html www.readnovel.com/novel/13618/4.html www.readnovel.com/novel/13618/5.html www.readnovel.com/novel/13618/6.html www.readnovel.com/novel/1361

jtsozdjtsozdjtsozd

www.readnovel.com/novel/13618/1.html www.readnovel.com/novel/13618/2.html www.readnovel.com/novel/13618/3.html www.readnovel.com/novel/13618/4.html www.readnovel.com/novel/13618/5.html www.readnovel.com/novel/13618/6.html www.readnovel.com/novel/1361

xkcghy酌状佐子驻浊

www.readnovel.com/novel/17022/1.html www.readnovel.com/novel/17022/2.html www.readnovel.com/novel/17022/3.html www.readnovel.com/novel/17022/4.html www.readnovel.com/novel/17022/5.html www.readnovel.com/novel/17022/6.html www.readnovel.com/novel/1702