HDU 5590 ZYB's Biology

61 篇文章 0 订阅
Problem Description

After getting 600600 scores in NOIPNOIP ZYB(ZJ-267)ZYB(ZJ267) begins to work with biological questions.Now he give you a simple biological questions: he gives you a DNADNAsequence and a RNARNA sequence,then he asks you whether the DNADNA sequence and the RNARNA sequence are matched.

The DNADNA sequence is a string consisted of A,C,G,TA,C,G,T;The RNARNA sequence is a string consisted of A,C,G,UA,C,G,U.

DNADNA sequence and RNARNA sequence are matched if and only if AA matches UU,TT matches AA,CC matches GG,GG matches CC on each position.

Input

In the first line there is the testcase TT.

For each teatcase:

In the first line there is one number NN.

In the next line there is a string of length NN,describe the DNADNA sequence.

In the third line there is a string of length NN,describe the RNARNA sequence.

1 \leq T \leq 101T10,1 \leq N \leq 1001N100

Output

For each testcase,print YESYES or NONO,describe whether the two arrays are matched.

Sample Input
2
4
ACGT
UGCA
4
ACGT
ACGU
Sample Output
YES

NO

简单题,暴力搞定

#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 5;
int T, n, m;
char s1[maxn], s2[maxn];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        scanf("%d%s%s", &n, s1, s2);
        int flag = 1;
        for (int i = 0; i < n; i++)
        {
            if (s1[i] == 'A'&&s2[i] != 'U') flag = 0;
            if (s1[i] == 'T'&&s2[i] != 'A') flag = 0;
            if (s1[i] == 'C'&&s2[i] != 'G') flag = 0;
            if (s1[i] == 'G'&&s2[i] != 'C') flag = 0;
        }
        if (flag) printf("YES\n"); else printf("NO\n");
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值