zoukankan      html  css  js  c++  java
  • 汇编练习Complementary DNA

    Description:

    Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms.

    If you want to know more http://en.wikipedia.org/wiki/DNA

    In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You have a function with one side of the DNA (string, except for Haskell); you need to get the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell).

    More similar exercise are found here http://rosalind.info/problems/list-view/ (source)

    DNA_strand ("ATTGC") # return "TAACG"
    
    DNA_strand ("GTAT") # return "CATA"



    SECTION .text
    global dna_strand
    extern strdup
    dna_strand:
      call strdup
      xor  rcx,rcx
      .b:movzx rdx,byte[rax+rcx]
         mov   dl,[.replace+rdx-'A']
         mov   [rax+rcx],dl
         inc   rcx
         cmp   byte[rax+rcx],0
      jne .b   
      ret
     .replace      db 'T',0,'G',0,0,0,'C'
     times 'T'-'H' db 0
                   db 'A'

    代码摘自:https://www.codewars.com/kata/554e4a2f232cdd87d9000038/solutions

    代码是codewar上面的,记录一下这总写法,过几天自己再来写一遍这道题,并且使用该方法

  • 相关阅读:
    python-文件操作
    python之-字符编码
    课程总结
    IO流文件输出流的应用
    字符串的基本操作
    数据结构字符串实训报告
    窗口的切换
    事件处理
    Java异常处理
    二维数组实现转置
  • 原文地址:https://www.cnblogs.com/pppyyyzzz/p/13627776.html
Copyright © 2011-2022 走看看