突然觉得心好累,BestCoder在1500~1700之间一晃就是几个月,但我还是依旧那么水,怎么也跨不过1700的坎
1001 ZYB's Biology
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
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
Source
/************************************************************************/
附上该题对应的中文题
ZYB's Biology
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 131072/131072 K (Java/Others)
问题描述
ZYB(ZJ−267)在NOIP拿到600分之后开始虐生物题,他现在扔给你一道简单的生物题:给出一个DNA序列和一个RNA序列, 问它们是否配对。 DNA序列是仅由A,C,G,T组成的字符串,RNA序列是仅由A,C,G,U组成的字符串。 DNA和RNA匹配当且仅当每个位置上A与U,T与A,C与G,G与C匹配。
输入描述
第一行一个整数T表示数据组数。 对于每组数据: 第一行一个整数N表示DNA和RNA序列的长度. 第二行一个长度为N的字符串A表示DNA序列. 第三行一个长度为N的字符串B表示RNA序列. 1≤T≤10,1≤N≤100
输出描述
对于每组数据,输出一行YES或NO,表示是否匹配.
输入样例
2 4 ACGT UGCA 4 ACGT ACGU
输出样例
YES NO
/****************************************************/
出题人的解题思路:
ZYB's Biology
直接按照题意模拟即可.
签到题,if语句判断一下就可以搞定了
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
#define exp 1e-10
using namespace std;
const int N = 105;
const int M = 10005;
const int inf = 1000000000;
const int mod = 2009;
char s1[N],s2[N];
int main()
{
int t,n,i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
scanf("%s",s1);
scanf("%s",s2);
for(i=j=0;i<n;i++,j++)
if(s1[i]=='A'&&s2[j]=='U'||s1[i]=='C'&&s2[j]=='G'||s1[i]=='G'&&s2[j]=='C'||s1[i]=='T'&&s2[j]=='A')
continue;
else
break;
if(i!=n)
puts("NO");
else
puts("YES");
}
return 0;
}
1002 ZYB's Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
Problem Description
ZYB
played a game named
NumberBomb
with his classmates in hiking:a host keeps a number in
[1,N]
in mind,then
players guess a number in turns,the player who exactly guesses X loses,or the host will tell all the players that
the number now is bigger or smaller than X .After that,the range players can guess will decrease.The range is [1,N] at first,each player should guess in the legal range.
Now if only two players are play the game,and both of two players know the X ,if two persons all use the best strategy,and the first player guesses first.You are asked to find the number of X that the second player
will win when X is in [1,N] .
players guess a number in turns,the player who exactly guesses X loses,or the host will tell all the players that
the number now is bigger or smaller than X .After that,the range players can guess will decrease.The range is [1,N] at first,each player should guess in the legal range.
Now if only two players are play the game,and both of two players know the X ,if two persons all use the best strategy,and the first player guesses first.You are asked to find the number of X that the second player
will win when X is in [1,N] .
Input
In the first line there is the number of testcases
T
.
For each teatcase:
the first line there is one number N .
1≤T≤100000 , 1≤N≤10000000
For each teatcase:
the first line there is one number N .
1≤T≤100000 , 1≤N≤10000000
Output
For each testcase,print the ans.
Sample Input
1 3
Sample Output
1
Source
/************************************************************************/
附上该题对应的中文题
ZYB's Game
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
问题描述
ZYB在远足中,和同学们玩了一个“数字炸弹”游戏:由主持人心里想一个在[1,N]中的数字X,然后玩家们轮流猜一个数字,如果一个玩家恰好猜中X则算负,否则主持人将告诉全场的人当前的数和X比是偏大还是偏小,然后猜测的范围就会相应减小,一开始的范围是[1,N].每个玩家只能在合法的范围中猜测. 现在假设只有两个人在玩这个游戏,并且两个人都已经知道了最后的X,若两个人都采取最优策略.求X∈[1,N]中是后手胜利的X数量.
输入描述
第一行一个整数T表示数据组数。 接下来T行,每行一个正整数N. 1≤T≤100000,1≤N≤10000000
输出描述
T行每行一个整数表示答案.
输入样例
1 3
输出样例
1
/****************************************************/
出题人的解题思路:
ZYB's Game
我们会发现这个模型其实是类比于左右两堆石子,每次可以在一堆里取任意多,取完的人胜利.当左右两堆石子相同时,我们可以简单的
构造后手胜利的方法:即在另一堆石子中取走同样多的石子,否则,先手可以取一些石子使得两堆石子相同.所以,当N是奇数输出1,否则输出0.
这道题出题人写得还算详细,就算我们一时间想不出来也不要紧,我们完全可以举一下例子,从举例子的过程中发现规律,这是很多时候没有思路的情况下可以做的事情
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
#define exp 1e-10
using namespace std;
const int N = 105;
const int M = 10005;
const int inf = 1000000000;
const int mod = 2009;
int main()
{
int t,n,i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
if(n%2)
puts("1");
else
puts("0");
}
return 0;
}
欢迎交流
菜鸟成长记