ZYB's Biology

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 713    Accepted Submission(s): 522

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
 
题意:给一段DNA和RNA问是否配对
#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
#define LL long long
#define PI atan(1.0)*4
#define DD double
#define MAX 110
#define mod 10007
#define dian 1.000000011
char s1[MAX],s2[MAX];
using namespace std;
int judge(int x)
{
int flag=0;
if(s1[x]=='A'&&s2[x]=='U')
flag=1;
else if(s1[x]=='C'&&s2[x]=='G')
flag=1;
else if(s1[x]=='G'&&s2[x]=='C')
flag=1;
else if(s1[x]=='T'&&s2[x]=='A')
flag=1;
if(flag) return 1;
else return 0;
}
int main()
{
int t,n,m,i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
scanf("%s",s1);
scanf("%s",s2);
int flag=1;
for(i=0;i<n;i++)
{
if(!judge(i))
{
flag=0;
break;
}
}
if(flag) printf("YES\n");
else printf("NO\n");
}
return 0;
}

  

BestCoder Round #65 hdu5590(水题)的更多相关文章

  1. hdu 5284 BestCoder Round #48 ($) 1001 水题 *

    题意:看一个字符串中是否包含顺序的  w  y  h ,字符之间可以有其他字符,并且如果有多个连续的vv,则可以看做一个w 比较水,直接看代码 #include<cstdio> #incl ...

  2. HDU5804 Price List (BestCoder Round #86 A)水题

    分析:大于总和输出1 #include <cstdio> #include <cstring> #include <algorithm> using namespa ...

  3. Bestcoder round #65 && hdu 5593 ZYB's Tree 树形dp

    Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...

  4. Bestcoder round #65 && hdu 5592 ZYB's Premutation 线段树

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...

  5. bestcoder Round #7 前三题题解

    BestCoder Round #7 Start Time : 2014-08-31 19:00:00    End Time : 2014-08-31 21:00:00Contest Type : ...

  6. BestCoder Round #86 二,三题题解(尺取法)

    第一题太水,跳过了. NanoApe Loves Sequence题目描述:退役狗 NanoApe 滚回去学文化课啦! 在数学课上,NanoApe 心痒痒又玩起了数列.他在纸上随便写了一个长度为 nn ...

  7. BestCoder Round #85 前三题题解

    sum Accepts: 822 Submissions: 1744 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/13107 ...

  8. BestCoder Round #65 hdu5591(尼姆博弈)

    ZYB's Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  9. BestCoder Round #65 (ZYB's Biology)

    ZYB's Biology Accepts: 848 Submissions: 1199 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 13 ...

随机推荐

  1. STL源码中map和set中key值不能修改的实现

    前言 最近正好刚刚看完,<stl源码剖析>这本书的map和set的源码部分.但是看完之后又突然发现,之前怎么没有注意到map和set容器中key不能修改是怎么实现的.故,特此整理如下. s ...

  2. tc 2014 college tour 250 500

    题意: You are given a long long n. Return the largest divisor of n that is a perfect square. That is, ...

  3. poj 2777 Count Color(线段树 区间更新)

    题目:http://poj.org/problem?id=2777 区间更新,比点更新多一点内容, 详见注释,  参考了一下别人的博客.... 参考博客:http://www.2cto.com/kf/ ...

  4. Catalan数推导(转载)

    Raney引理: 设整数序列A = {Ai, i=1, 2, …, N},且部分和Sk=A1+…+Ak,序列中所有的数字的和SN=1,在A的N个循环表示中,有且仅有一个序列B,满足B的任意部分和Si均 ...

  5. codevs 1135 选择客栈

    这题没什么话说. #include<iostream> #include<cstdio> #include<cstring> #include<algorit ...

  6. DbgPrint输出格式 Unicodestring

    DbgPrint输出格式 Unicodestring  1) 直接打印字符串. DbgPrint("Hello World!"); 2) 空结尾的字符串,你可以用普通得C语法表示字 ...

  7. I.MX6 Android U-blox miniPCI 4G porting

    /************************************************************************** * I.MX6 Android U-blox m ...

  8. UVA 10801 Lift Hopping 电梯换乘(最短路,变形)

    题意: 有n<6部电梯,给出每部电梯可以停的一些特定的楼层,要求从0层到达第k层出来,每次换乘需要60秒,每部电梯经过每层所耗时不同,具体按 层数*电梯速度 来算.问经过多少秒到达k层(k可以为 ...

  9. Oracle 课程二之Oracle数据库逻辑结构

    完成本课程的学习后,您应该能够: •数据库总体的逻辑结构 •深入理解数据库最小存储单元block •理解行迁移和行链接 •理解高水位线 •Drop.truncate.delete区别   1.数据库的 ...

  10. android moveTaskToback 应用退到后台,类似最小化

    方法:public boolean moveTaskToBack(boolean nonRoot) activity里有这个方法,参数说明如下: nonRoot=false→ 仅当activity为t ...