首页 > 其他 > 详细

HDOJ:5590

时间:2015-12-09 16:41:01      阅读:215      评论:0      收藏:0      [点我收藏+]
Problem Description
After getting 600 scores in NOIP ZYB(ZJ267) 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.

1T10,1N100
 

 

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
 
 
 

#include <iostream>
#include <cstdio>
#include <STRING.H>
using namespace std;

int main()
{
  int T,N,i,count;
  char a[109],b[109];

  cin>>T;
  while (T--)
  {
    cin>>N;
    count=0;
    for(i=0;i<N;i++)
    {
      cin>>a[i];
    }
    for(i=0;i<N;i++)
    {
      cin>>b[i];
    }
    for(i=0;i<N;i++)
    {
      if((a[i]==‘A‘&&b[i]==‘U‘)||(a[i]==‘C‘&&b[i]==‘G‘)||(a[i]==‘G‘&&b[i]==‘C‘)||(a[i]==‘T‘&&b[i]==‘A‘))
      count++;
    }
    if(count==N)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
}
return 0;
}

HDOJ:5590

原文:http://www.cnblogs.com/xiangrutt/p/5032967.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!