• BestCoder Round #65 hdu5590(水题)


    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(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
     
    题意:给一段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
    ");
        	else printf("NO
    ");
        }
    	return 0;
    } 
    

      

  • 相关阅读:
    使用内部单向链表实现的一个简单堆栈
    通过反射调用内部类的隐藏方法
    动态代理生成空对象
    通过使用java.lang.reflect.Proxy实现动态代理
    简单代理模式
    暗色CSS,适用与Stylish, IE, FF, OPERA等.
    CWnd派生的控件处理MouseMove, MouseHover, MouseLeave
    _tcscpy_s的size应至少为src的长度+1(要把计算在内)
    用INET(CHttpFile)下载有重定向链接时获取最终URL的方法.
    GetDlgItem以及其他获得CWnd相关的函数要注意。。
  • 原文地址:https://www.cnblogs.com/tonghao/p/5231232.html
Copyright © 2020-2023  润新知