HDU 5590 ZYB's Biology

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
Copy
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;
}


你可能感兴趣的:(HDU)