poj 1007 DNA Sorting
来源:互联网 发布:最近网络最流行的话 编辑:程序博客网 时间:2024/06/01 08:03
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.
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 6AACATGAAGGTTTTGGCCAATTTGGCCAAAGATCAGATTTCCCGGGGGGAATCGATGCAT
Sample Output
CCCGGGGGGAAACATGAAGGGATCAGATTTATCGATGCATTTTTGGCCAATTTGGCCAAA题意:对于一个DNA字符串,如果前面的字符大于后面的字符叫做倒序,按照倒序程度大小排序。思路:利用结构体存储倒序字母个数。按照这个个数排序,输出。
0 0
- POJ 1007 DNA Sorting
- poj 1007 DNA Sorting
- POJ 1007 DNA Sorting
- POJ-1007 DNA Sorting
- 【POJ】1007 DNA Sorting
- POJ-1007:DNA Sorting
- poj 1007 DNA Sorting
- POJ 1007 DNA Sorting
- POJ 1007 DNA Sorting
- poj 1007 DNA Sorting
- POJ 1007 DNA Sorting
- 【POJ】1007 DNA Sorting
- poj 1007 DNA sorting
- POJ 1007 DNA Sorting
- poj 1007 DNA Sorting
- [POJ][1007]DNA Sorting
- POJ 1007 DNA Sorting
- poj 1007 DNA sorting
- 重载函数
- android listview 每一项都是edittext 导致的坑爹问题 内容的保存和焦点,光标位置的设置
- iOS-自定义cell的方法步骤
- hdu 1166 敌兵布阵——(区间和)树状数组/线段树
- 4 IoC容器的依赖注入(2)
- poj 1007 DNA Sorting
- 不同页面之间传递值
- Android之四大布局【LinearLayout,TableLayout,FrameLayout,RelativeLayout】
- 利用JavaScript选择GridView行
- 使用Gridview绑定数据库中的图片
- linux后台开发知识点
- 给collectionView设置头标题视图:
- POJ-2083 Fractal-X星阵图
- 传智19期.NET 就业班视频