ZZULIOJ.1221: The Other Part of DNA

1221: The Other Part of DNA

题目描述

Dellenge is a very warm-hearted person. He likes to help his friend solve problems. One Day, Night Guard have a biological problem. He cannot solve it by himself. So he asked Dellenge for help. But Dellenge’s

Biological is very poor. He can’t solve it too. Now, can you help them to solve the problem? Here is the problem :

We all Know that the information in DNA is stored as a code made up of four chemical bases: adenine (A), guanine (G), cytosine ©, and thymine (T). DNA bases pair up with each other, A with T and C with G, to form units called base pairs.

Now, we give you one part of a DNA sequence, can you tell me another.

输入The first line is an integer t, which means the number of cases in the data file. Each case will have a single line, that’s DNA sequence which we give you. The length of the sequence is less than 100
输出For each test case, you have to output another part of the DNA. One case, one line.
样例输入
2
ATCG
ACAC

样例输出
TAGC
TGTG

/*德伦格是一个非常热心的人。他喜欢帮助朋友解决问题。
有一天,夜班卫兵有一个生物学问题。他自己解决不了。所以他请德伦格帮忙。
但是Dellenge的生物很差。他也解决不了。
现在,你能帮助他们解决这个问题吗?问题在于:
我们都知道DNA中的信息是以由四个化学碱基组成的密码存储的:
腺嘌呤(A)、鸟嘌呤(G)、胞嘧啶(C)和胸腺嘧啶(T)。
DNA碱基彼此配对,A与T和C与G,形成单位称为碱基对
现在,我们给你一个DNA序列的一部分,你能告诉我另一个吗?
内幕
第一行是整数T,这意味着数据文件中的情况数。每个病例都会有一条线,那就是我们给你的DNA序列。序列长度小于100.
特技    
对于每个测试用例,你必须输出DNA的另一部分。一例,一行。*/
#include<stdio.h>
#include<string.h>
int main()
{
     int n,len,i;
    char str[100];
 scanf("%d",&n);
 while(n--)
 {
  memset(str,0,sizeof(str));
  scanf("%s",str);
  len=strlen(str);
  for(i=0;i<len;i++)
  {
   if(str[i]=='A')
   str[i]='T';
   else if(str[i]=='T')
   str[i]='A';
   else if(str[i]=='C')
   str[i]='G';
   else
   str[i]='C';
  }
  printf("%s\n",str);
 }
 return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值