天天看點

HDU 5590 ZYB's Biology

Problem Description

After getting  scores in   begins to work with biological questions.Now he give you a simple biological questions: he gives you a sequence and a  sequence,then he asks you whether the  sequence and the 

The  sequence is a string consisted of ;The  sequence is a string consisted of .

 sequence and  sequence are matched if and only if  matches , matches , matches , matches 

Input

In the first line there is the testcase .

For each teatcase:

In the first line there is one number .

In the next line there is a string of length ,describe the 

In the third line there is a string of length ,describe the 

,

Output

For each testcase,print  or ,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;
}