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上面的,记录一下这总写法,过几天自己再来写一遍这道题,并且使用该方法

  • 相关阅读:
    列表
    break和continue
    第三天下午
    第二天
    简历,面试
    周三 景安
    应届生求职优势(我的求职心…

    2013年01月02日
    Click and Drag
  • 原文地址:https://www.cnblogs.com/pppyyyzzz/p/13627776.html
Copyright © 2011-2022 走看看