- 1、本文档共4页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 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 的长度,在定义字符串数组的时候易出现拥变量定义数组的行和列的情况,导致编译错
您可能关注的文档
- PEP小学英语五年级下册第一单元测试卷.docx
- PEP小学英语五年级下册教学片段设计.docx
- PEP小学英语五年级下册句子复习(汉译英).docx
- PEP小学英语五年级下二单元复习课教学设计教案资料.docx
- pep小学英语音标练习.docx
- PEP小学英语语音资料.docx
- pep英语四年级下册第6单元教学设计新部编版.docx
- Permanent Magnets Design and Magnetic Field Analysis of Multidisc Coreless Permanent Magnet Synchro分析和总结分析和总结.docx
- PET核心词汇21天分析和总结.docx
- PE袋初包装封口验证报告.docx
最近下载
- 2024年电信智慧家庭工程师(三级)认证考试题库-中(多选题部分).docx
- 11《山地回忆》第一课时 +公开课一等奖创新教案+导学案.docx VIP
- 0i-TF PLUS车床操作说明书.pdf
- 2024年电信智慧家庭工程师(三级)认证考试题库-下(判断题部分).docx
- 2024年电信智慧家庭工程师(三级)认证考试题库-上(单选题部分).docx
- 重生之我在古代当皇帝课件高二上学期自律主题班会.pptx
- 2025第三届全国技能大赛海南省选拔赛-数字孪生应用技术(国赛精选)项目技术文件.pdf VIP
- 质量管理六大工具-PPAP.pptx
- 苯并噻唑衍生物及作为荧光染料上的应用.pdf VIP
- 新编剑桥商务英语(高级)学生用书(第三版修订版)达姆特教材习题答案笔记及workbook答案.pdf
文档评论(0)