网站大量收购独家精品文档,联系QQ:2885784924

poj 1007分析和总结分析和总结.docx

  1. 1、本文档共4页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
通过率:39% 难度:较难 DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 46899 Accepted: 18311 Description One measure of ``unsortedness in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC, this measure is 5, since D is greater than four letters to its right and E is greater than one letter to its right. This measure is called the number of inversions in the sequence. The sequence ``AACEDGG has only one inversion (E and D)---it is nearly sorted---while the sequence ``ZWQM has 6 inversions (it is as unsorted as can be---exactly the reverse of sorted). You are responsible for cataloguing a sequence of DNA strings (sequences containing only the four letters A, C, G, and T). However, you want to catalog them, not in alphabetical order, but rather in order of ``sortedness, from ``most sorted to ``least sorted. All the strings are of the same length. Input The first line contains two integers: a positive integer n (0 n = 50) giving the length of the strings; and a positive integer m (0 m = 100) giving the number of strings. These are followed by m lines, each containing a string of length n. Output Output the list of input strings, arranged from ``most sorted to ``least sorted. Since two strings can be equally sorted, then output them according to the orginal order. Sample Input 10 6 AACATGAAGG TTTTGGCCAA TTTGGCCAAA GATCAGATTT CCCGGGGGGA ATCGATGCAT CCCGGGGGGA AACATGAAGG GATCAGATTT ATCGATGCAT TTTTGGCCAA TTTGGCCAAA 翻译:给出几条 DNA 序列,序列中只包含“A”,“C”,“T”,“G”,要求若序列中任意一个字母,在它后面只要有一个小于它的字母,则记一个染色体倒置,将输入的DNA 序列按各自染色体倒置的总数从小到大排序输出,其中要求 DNA 条数要在 0 到 100 之间,DNA 序列的长度即包含的字母个数要在 0 到 50 之间,若有两条 DNA 的倒置总数一样,则将这两条DNA 原序输出 解题思路: 对每一条 DNA 对应一个变量,对它的的第i 个字母,将第 i 个字母之后的每个字母依次与第i 个字母比较,若小于则变量值加(i 可取DNA 的第一个字母到倒数第二个字母进行循环), 然后将每一条DNA 对应的变量值进行比较,从第一个开始,若后面某个变量值大于它则将它们对应的字符串(即 DNA 序列)相互交换,如此循环,最后将DNA 序列按顺序输出就是按要求排好的一条一条的DNA 序列 总结及出错情况: 题目要求是要输入 DNA 条数和每条 DNA 的长度,在定义字符串数组的时候易出现拥变量定义数组的行和列的情况,导致编译错

文档评论(0)

tianya189 + 关注
官方认证
内容提供者

该用户很懒,什么也没介绍

认证主体阳新县融易互联网技术工作室
IP属地湖北
统一社会信用代码/组织机构代码
92420222MA4ELHM75D

1亿VIP精品文档

相关文档