Java-POJ1007-DNA Sorting】的更多相关文章

[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…
这题比较简单,重点应该在如何减少循环次数. 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…
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…
欢迎参加——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: 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: 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 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: 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…
点击打开链接 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: 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: 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…
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…
http://poj.org/problem?id=1007 (题目链接) 题意 给出m个字符串,将其按照逆序对个数递增输出. Solution 树状数组经典应用. 代码 // poj1007 #include<algorithm> #include<iostream> #include<cstring> #include<cstdlib> #include<cstdio> #include<cmath> #include<st…
DNA排序 题目大意:给定多个ACGT序列,按照字母顺序算出逆序数,按逆序数从小到大排列 这题其实很简单,我们只要用一个归并排序算逆序数,然后快排就可以了(插入排序也可以,数据量不大),但是要注意的是他要保持原来的顺序,fcmop那里要写当a.inverse=b.inverse时,返回0 #include <iostream> #include <functional> #include <algorithm> using namespace std; typedef…
题目链接: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…
原题链接 题目大意:给定一串字符串,查找字符串里字母逆序排列的对数,按照由少到多的顺序把所有字符串进行排列. 解法:用C++字符串string类的iterator,从每个字符串的起始开始,查找逆序字符的个数,然后用qsort方法按照reverseCount的大小快速排序. 参考代码: #include<iostream> #include<string> #include<string.h> #include<cstdlib> #include<cst…
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…
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…
关于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.…
#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&…
POJ 排序的思想就是根据选取范围的题目的totalSubmittedNumber和totalAcceptedNumber计算一个avgAcceptRate. 每一道题都有一个value,value = acceptedNumber / avgAcceptRate + submittedNumber. 这里用到avgAcceptedRate的原因是考虑到通过的数量站的权重可能比提交的数量占更大的权重,所以给acceptedNumber乘上了一个因子. 当然计算value还有别的方法,比如POJ上…
DNA Sorting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2203    Accepted Submission(s): 1075 Problem Description One measure of ``unsortedness'' in a sequence is the number of pairs of entri…
 DNA Sorting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2357    Accepted Submission(s): 1158 Problem Description One measure of ``unsortedness'' in a sequence is the number of pairs of e…
首先是昨天在北京大学oj网上看到一个简单的算法题目,虽然简单,但是如何完成一段高效.简洁.让人容易看懂的代码对于我这个基础不好,刚刚进入计算机行业的小白来说还是有意义的.而且在写代码的过程中,会发现自己平时学习中不会发现的问题,所以想写下这个博客,主要是便于自己对算法的理解. 来,上题. DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 91599   Accepted: 36781 Descript…
翻译人员: 铁锚 翻译时间: 2013年11月23日 原文链接: Start from length & length() in Java 首先请看下面的问题,你能快速地回答上来吗? 假设没有任何集成开发环境和自动补全功能,如何获取数组的长度?如何取得字符串的长度? 我将为  新手以及中等水平这个水平之间的开发者回答这个问题:.因为他们中的很多人并不能正确回答出来,或者是对自己的答案缺乏信心(译者注: 老外的初级程序员真的这样么). 虽然IDE提供了方便快捷的代码补全功能,但同时也附带了一个缺点…
Java Algorithm Problems 程序员的一天 从开始这个Github已经有将近两年时间, 很高兴这个repo可以帮到有需要的人. 我一直认为, 知识本身是无价的, 因此每逢闲暇, 我就会来维护这个repo, 给刷题的朋友们一些我的想法和见解. 下面来简单介绍一下这个repo: README.md: 所有所做过的题目 ReviewPage.md: 所有题目的总结和归纳(不断完善中) KnowledgeHash2.md: 对所做过的知识点的一些笔记 SystemDesign.md:…
2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 1003 Hangover792.762000 1001 Exponentiation752.486000 1006 Biorhythms705.902000 1005 I Think I Need a Houseboat686.540000 1011 Sticks647.566000 1007…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 83442   Accepted: 33584 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…