hdu 5590 ZYB's Biology

时间:2023-03-17 22:30:22
hdu 5590 ZYB's Biology
Problem Description
After getting  scores in NOIP ZYB(ZJ−) 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.

≤T≤,≤N≤
Output
For each testcase,print YES or NO,describe whether the two arrays are matched.
Sample Input

ACGT
UGCA ACGT
ACGU
Sample Output
YES
NO
Source
 #pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<stdlib.h>
#include <stack>
using namespace std;
#define PI acos(-1.0)
#define max(a,b) (a) > (b) ? (a) : (b)
#define min(a,b) (a) < (b) ? (a) : (b)
#define ll long long
#define eps 1e-10
#define MOD 1000000007
#define N 106
#define inf 1e12
int n;
char s1[N];
char s2[N];
int main()
{
int t;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
scanf("%s",s1);
scanf("%s",s2);
int flag=;
for(int i=;i<n;i++){
if(s1[i]=='A'){
if(s2[i]!='U'){
flag=;
break;
}
}
else if(s1[i]=='T'){
if(s2[i]!='A'){
flag=;
break;
}
}
else if(s1[i]=='C'){
if(s2[i]!='G'){
flag=;
break;
}
}
else if(s1[i]=='G'){
if(s2[i]!='C'){
flag=;
break;
}
}
}
if(flag){
printf("YES\n");
}else{
printf("NO\n");
} }
return ;
}