【水】HDOJ ZYB's Biology 5590

来源:互联网 发布:进出口银行 知乎 编辑:程序博客网 时间:2024/05/16 00:58

ZYB's Biology

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


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
24ACGTUGCA4ACGTACGU
 

Sample Output
YESNO
 

Source
BestCoder Round #65
 


AC代码:

#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int main(){    int t;    scanf("%d",&t);    while(t--){        char D[110],R[110];        int N;        scanf("%d",&N);        scanf("%s%s",D,R);        int LD=strlen(D);        int LR=strlen(R);        if(LD!=LR){            printf("NO\n");            continue;        }        int flag=1;        for(int i=0;i<N;i++){            if(D[i]=='A'&&R[i]=='U')continue;            else if(D[i]=='T'&&R[i]=='A')continue;            else if(D[i]=='C'&&R[i]=='G')continue;            else if(D[i]=='G'&&R[i]=='C')continue;            flag=0;        }        if(flag)printf("YES\n");        else printf("NO\n");    }    return 0;}


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 眼镜镜片磨花了怎么办 戴眼镜鼻梁有印怎么办 狗狗发烧怎么办最有效 狗狗感冒怎么办最有效 狗狗发烧去医院怎么办 眼睛里长了虫子怎么办 吃了没熟的猪肉怎么办 没熟的鸡肉吃了怎么办 狗狗大便有绦虫怎么办 吃了有虫的猪肉怎么办 米猪肉吃了会怎么办 吃了鱼的寄生虫怎么办 鱼身体里有线虫怎么办 幼猫半夜一直叫怎么办 猫半夜4点叫不停怎么办 眼睛里长了黄斑怎么办 眼睛周围长小疙瘩怎么办 眼睛被手机砸了怎么办 眼睛被东西砸了怎么办 眼睛被打了一下怎么办 眼睛被树枝伤了怎么办 眼球被打了一下怎么办 眼睛黄有血丝是怎么办 上眼皮有异物感怎么办 20岁眼周围皱纹怎么办 才22岁眼睛皱纹怎么办 眼周围发干皱纹怎么办 眼周围淤血肿了怎么办 每到秋季就咳嗽怎么办 左肾泥沙样结石怎么办 双肾泥沙样结石怎么办 温州市民卡丢了怎么办 上眼皮过敏肿了怎么办 上眼皮又痒又肿怎么办 上眼皮红肿痛是怎么办 上眼皮肿的厉害怎么办 眼皮肿了还痒痒怎么办 眼睛被手指戳到怎么办 打球眼睛撞肿了怎么办 打球时眼睛被戳怎么办 狗眼睛被打充血怎么办