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(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.
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
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问是否配对
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #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
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· C# 13 中的新增功能实操
· Ollama本地部署大模型总结
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(4)
· langchain0.3教程:从0到1打造一个智能聊天机器人
· 2025成都.NET开发者Connect圆满结束