hdoj-5590-ZYB's Biology
来源:互联网 发布:sass for mac中文版 编辑:程序博客网 时间:2024/06/05 00:11
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 aDNA sequence and a RNA sequence,then he asks you whether the DNA sequence and the RNA sequence are
matched.
TheDNA sequence is a string consisted of A,C,G,T ;TheRNA 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.
he gives you a
matched.
The
Input
In the first line there is the testcase T .
For each teatcase:
In the first line there is one numberN .
In the next line there is a string of lengthN ,describe the DNA sequence.
In the third line there is a string of lengthN ,describe the RNA sequence.
1≤T≤10 ,1≤N≤100
For each teatcase:
In the first line there is one number
In the next line there is a string of length
In the third line there is a string of length
Output
For each testcase,print YES or NO ,describe whether the two arrays are matched.
Sample Input
24ACGTUGCA4ACGTACGU
Sample Output
YESNO
高中生物题,DNA和RNA的匹配
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;bool judge(char x,char y){ if(x=='A'&&y=='U') return true; else if(x=='T'&&y=='A') return true; else if(x=='C'&&y=='G') return true; else if(x=='G'&&y=='C') return true; return false;}int main(){ int t; scanf("%d",&t); char d[100],r[100]; while(t--) { int n; bool flag=true; scanf("%d",&n); scanf("%s",d); scanf("%s",r); //printf("%s %s\n",dna,rna); for(int i=0;i<n;i++) { flag=judge(d[i],r[i]); //printf("%d\n",flag); if(flag==false) break; } if(flag) printf("YES\n"); else printf("NO\n"); } return 0;}
0 0
- HDOJ 5590 ZYB's Biology
- HDOJ 5590 ZYB's Biology
- hdoj-5590-ZYB's Biology
- hdoj 5590 ZYB's Biology 【水题】
- 【水】HDOJ ZYB's Biology 5590
- hdoj 5592 ZYB's Biology 【线段树】 hdoj 5590 ZYB's Biology 【字符串水题】
- hdoj ZYB's Biology 5590 (字符串) 水
- HDU 5590 ZYB's Biology
- HDU 5590 ZYB's Biology
- 杭电5590 ZYB's Biology
- hdu 5590 ZYB's Biology(水)
- ZYB's Biology
- ZYB's Biology解题报告
- BestCoder Round #65 ZYB's Biology
- BestCoder Round #65 1001 ZYB's Biology HDU5590
- HDOJ 5591 ZYB's Game
- hdoj-5591-ZYB's Game
- hdoj 5591 ZYB's Game 【水题】
- KMP算法
- mySQL
- IOS在后台每隔一段时间执行一下 资料2
- 时间复杂度与空间复杂度
- bzoj 1176: [Balkan2007]Mokia 【CDQ分治】
- hdoj-5590-ZYB's Biology
- Java 代码块
- 【mybatis基础】mybatis开发dao两种方法
- Oracle 11g 管理Oracle 集群
- ios在后台每隔一段时间执行一下 资料3
- 24点游戏-穷举破解
- 二叉搜索树中找出比K大的最小的那个数
- LeetCode 242. Valid Anagram C语言
- BFS 搜索 Problem 1015 Knight Moves "马走日"之最少步数