BestCoder Round #65

突然觉得心好累,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(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
 

Source
 

/************************************************************************/

附上该题对应的中文题

ZYB's Biology

 
 Time Limit: 2000/1000 MS (Java/Others)
 
 Memory Limit: 131072/131072 K (Java/Others)
问题描述
ZYB(ZJ-267)ZYB(ZJ267)NOIPNOIP拿到600600分之后开始虐生物题,他现在扔给你一道简单的生物题:给出一个DNADNA序列和一个RNARNA序列,
问它们是否配对。

DNADNA序列是仅由A,C,G,TA,C,G,T组成的字符串,RNARNA序列是仅由A,C,G,UA,C,G,U组成的字符串。

DNADNARNARNA匹配当且仅当每个位置上AAUU,TTAA,CCGG,GGCC匹配。
输入描述
第一行一个整数TT表示数据组数。

对于每组数据:

第一行一个整数NN表示DNADNARNARNA序列的长度.

第二行一个长度为NN的字符串AA表示DNADNA序列.

第三行一个长度为NN的字符串BB表示RNARNA序列.

1 \leq T \leq 101T10,1 \leq N \leq 1001N100
输出描述
对于每组数据,输出一行YESYESNONO,表示是否匹配.
输入样例
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] .
 

Input
In the first line there is the number of testcases  T .

For each teatcase:

the first line there is one number  N .

1T100000 , 1N10000000
 

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)
问题描述
ZYBZYB在远足中,和同学们玩了一个“数字炸弹”游戏:由主持人心里想一个在[1,N][1,N]中的数字XX,然后玩家们轮流猜一个数字,如果一个玩家恰好猜中XX则算负,否则主持人将告诉全场的人当前的数和XX比是偏大还是偏小,然后猜测的范围就会相应减小,一开始的范围是[1,N][1,N].每个玩家只能在合法的范围中猜测.

现在假设只有两个人在玩这个游戏,并且两个人都已经知道了最后的XX,若两个人都采取最优策略.求X \in [1,N]X[1,N]中是后手胜利的XX数量.
输入描述
第一行一个整数TT表示数据组数。

接下来TT行,每行一个正整数NN.

1 \leq T \leq 1000001T100000,1 \leq N \leq 100000001N10000000
输出描述
TT行每行一个整数表示答案.
输入样例
1
3
输出样例
1
/****************************************************/

出题人的解题思路:

ZYB's Game

我们会发现这个模型其实是类比于左右两堆石子,每次可以在一堆里取任意多,取完的人胜利.当左右两堆石子相同时,我们可以简单的

构造后手胜利的方法:即在另一堆石子中取走同样多的石子,否则,先手可以取一些石子使得两堆石子相同.所以,当NN是奇数输出11,否则输出00.

这道题出题人写得还算详细,就算我们一时间想不出来也不要紧,我们完全可以举一下例子,从举例子的过程中发现规律,这是很多时候没有思路的情况下可以做的事情
#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;
}

欢迎交流

菜鸟成长记

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值