DNA Sorting POJ - 1007】的更多相关文章

DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 114211   Accepted: 45704 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 instan…
DNA排序 题目大意:给定多个ACGT序列,按照字母顺序算出逆序数,按逆序数从小到大排列 这题其实很简单,我们只要用一个归并排序算逆序数,然后快排就可以了(插入排序也可以,数据量不大),但是要注意的是他要保持原来的顺序,fcmop那里要写当a.inverse=b.inverse时,返回0 #include <iostream> #include <functional> #include <algorithm> using namespace std; typedef…
    DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 77786   Accepted: 31201 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 ins…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 80832   Accepted: 32533 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 instanc…
点击打开链接 DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 75164   Accepted: 30115 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…
一. 题目 DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95052   Accepted: 38243 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 i…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95437   Accepted: 38399 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 instanc…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95209   Accepted: 38311 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 instanc…
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 88690 Accepted: 35644 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…
这题比较简单,重点应该在如何减少循环次数. package practice; import java.io.BufferedInputStream; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; /** * DNA sorting * * @author caiyu * @date 2014-11-5 */ public class POJ1007 { public static void m…
[POJ1007]DNA Sorting 试题描述 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 fo…
欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) DNA Sorting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2182    Accepted Submission(s): 1062 Problem Description One measure of ``unsortedness'' in a sequenc…
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 83069 Accepted: 33428 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, i…
DNA Sorting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2329    Accepted Submission(s): 1145 Problem Description One measure of ``unsortedness'' in a sequence is the number of pairs of entr…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 105159   Accepted: 42124 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 instan…
题目链接:http://poj.org/problem?id=1007 本题属于字符串排序问题.思路很简单,把每行的字符串和该行字符串统计出的字母逆序的总和看成一个结构体.最后把全部行按照这个总和从小到大排序即可. #include <iostream> #include <algorithm> using namespace std; struct DNA { ]; int count; } d[]; int cmp(DNA a, DNA b) { return a.count…
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…
#include<iostream>//写字符串的题目可以用这种方式:str[i][j] &str[i] using namespace std; int main() {int n,m,i,j,num,a[101],b[101],t,k; char str[101][51]; cin>>n>>m; for(i=0;i<m;i++) { cin>>str[i]; num=0; for(j=0;j<n-1;j++) for(k=j+1;k&…
关于Java的题解,也许效率低下,但是能解决不只是ACGT的序列字符串 代码如下: import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); TreeMap<Integer,String> map = new TreeMap<Integer,String>(); //读入题目所给的信息 int n = sc.…
http://poj.org/problem?id=1007 (题目链接) 题意 给出m个字符串,将其按照逆序对个数递增输出. Solution 树状数组经典应用. 代码 // poj1007 #include<algorithm> #include<iostream> #include<cstring> #include<cstdlib> #include<cstdio> #include<cmath> #include<st…
基因修复 题目大意:给定一些坏串,再给你一个字符串,要你修复这个字符串(AGTC随便换),使之不含任何坏串,求修复所需要的最小步数. 这一题也是和之前的那个1625的思想是一样的,通过特殊的trie树找到所有的状态然后一个一个枚,具体状态转移的思想可以在1625那里看 当然了这一题不是像1625那样求总的组合数,这一题也是DP,求的是最小值,那么我们也是一样,统计从合法状态中转移到任何一个状态最小值即可. 状态转移方程dp[i+1][转移状态]=min(dp[i+1][转移状态],dp[i][当…
原题链接 题目大意:给定一串字符串,查找字符串里字母逆序排列的对数,按照由少到多的顺序把所有字符串进行排列. 解法:用C++字符串string类的iterator,从每个字符串的起始开始,查找逆序字符的个数,然后用qsort方法按照reverseCount的大小快速排序. 参考代码: #include<iostream> #include<string> #include<string.h> #include<cstdlib> #include<cst…
题目大意:DNA序列是有 ATGC 组成的,现在知道一些动物的遗传片段有害的,那么如果给出这些有害的片段,能否求出来所有长度为 N 的基因中有多少是不包含这些有害片段的.   分析:也是断断续续做了一天,做这道题前先做一下 hdu2157 这道题,因为这道题的思路就是从它转变过来的,看明白了这个后,就需要构造一个矩阵,不过因为按照自己的想法构造的矩阵,一直WA,不明白为什么,后来发现是因为在子节点不存在时候查询后缀时候包含子节点的时候不彻底造成的,还是对AC自动机了解的不多.不过通过这题也学会了…
Problem 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 let…
题意: 给出患病的DNA序列,问序列长度为n的,且不包含患病的DNA序列有多少种 解析: 以给出的患病DNA序列建trie树  患病结点要用flag标记 对于长度为n的序列 位置i有四种 情况A  C  T  G, buid的时候是从祖结点0开始的四种选择,如果tri树中存在某种选择,则顺着走下去,因为要防止恰好选择了患病DNA序列 若trie树中不存在某种选择,则指向0 即祖结点,因为这个点中断了患病DNA序列的生成 偷个图:https://blog.csdn.net/morgan_xww/a…
题目网址:http://poj.org/problem?id=3270 题目大意是:一串无序的数字,要排成增序的数列,可以交换不相邻的数,每交换两个数,sum+这两个数,使得sum最小,求最小的sum. 0 ms #include<iostream> #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; class A { public: int v; //…
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…
It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment ATC then it may mean that the animal may have a genetic di…
#include<stdio.h> #include<string.h> #include<algorithm> #include<stdlib.h> ][]; int m,n; ]; int cal(int i){ ; ;j<n;j++){ for(k=j;k<n;k++){ if(arr[i][k]<arr[i][j]){ num++; } } } return num; } int main(){ int i,j,k,temp,fla…
Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29694    Accepted Submission(s): 7788 Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat…