码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 5590 ZYB's Biology

时间:2015-12-10 21:30:04      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

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

 

 

 

Source

 

 

技术分享
 1 #pragma comment(linker, "/STACK:1024000000,1024000000")
 2 #include<iostream>
 3 #include<cstdio>
 4 #include<cstring>
 5 #include<cmath>
 6 #include<math.h>
 7 #include<algorithm>
 8 #include<queue>
 9 #include<set>
10 #include<bitset>
11 #include<map>
12 #include<vector>
13 #include<stdlib.h>
14 #include <stack>
15 using namespace std;
16 #define PI acos(-1.0)
17 #define max(a,b) (a) > (b) ? (a) : (b)
18 #define min(a,b) (a) < (b) ? (a) : (b)
19 #define ll long long
20 #define eps 1e-10
21 #define MOD 1000000007
22 #define N 106
23 #define inf 1e12
24 int n;
25 char s1[N];
26 char s2[N];
27 int main()
28 {
29    int t;
30    scanf("%d",&t);
31    while(t--){
32       scanf("%d",&n);
33       scanf("%s",s1);
34       scanf("%s",s2);
35       int flag=1;
36       for(int i=0;i<n;i++){
37          if(s1[i]==A){
38             if(s2[i]!=U){
39                flag=0;
40                break;
41             }
42          }
43          else if(s1[i]==T){
44             if(s2[i]!=A){
45                flag=0;
46                break;
47             }
48          }
49          else if(s1[i]==C){
50             if(s2[i]!=G){
51                flag=0;
52                break;
53             }
54          }
55          else if(s1[i]==G){
56             if(s2[i]!=C){
57                flag=0;
58                break;
59             }
60          }
61       }
62       if(flag){
63          printf("YES\n");
64       }else{
65          printf("NO\n");
66       }
67 
68 
69    }
70     return 0;
71 }
View Code

 

hdu 5590 ZYB's Biology

标签:

原文地址:http://www.cnblogs.com/UniqueColor/p/5037016.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!