博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj3080
阅读量:6859 次
发布时间:2019-06-26

本文共 3016 字,大约阅读时间需要 10 分钟。

Blue Jeans
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 7671   Accepted: 3184

Description

The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated. 
As an IBM researcher, you have been tasked with writing a program that will find commonalities amongst given snippets of DNA that can be correlated with individual survey information to identify new genetic markers. 
A DNA base sequence is noted by listing the nitrogen bases in the order in which they are found in the molecule. There are four bases: adenine (A), thymine (T), guanine (G), and cytosine (C). A 6-base DNA sequence could be represented as TAGACC. 
Given a set of DNA base sequences, determine the longest series of bases that occurs in all of the sequences.

Input

Input to this problem will begin with a line containing a single integer n indicating the number of datasets. Each dataset consists of the following components:
  • A single positive integer m (2 <= m <= 10) indicating the number of base sequences in this dataset.
  • m lines each containing a single base sequence consisting of 60 bases.

Output

For each dataset in the input, output the longest base subsequence common to all of the given base sequences. If the longest common subsequence is less than three bases in length, display the string "no significant commonalities" instead. If multiple subsequences of the same longest length exist, output only the subsequence that comes first in alphabetical order.

Sample Input

32GATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3GATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATAGATACTAGATACTAGATACTAGATACTAAAGGAAAGGGAAAAGGGGAAAAAGGGGGAAAAGATACCAGATACCAGATACCAGATACCAAAGGAAAGGGAAAAGGGGAAAAAGGGGGAAAA3CATCATCATCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCACATCATCATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACATCATCATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

Sample Output

no significant commonalitiesAGATACCATCATCAT

Source

 
字符串水过: O(m*n^4)
 
Source CodeProblem: 3080		User: BUPT_ERICMemory: 732K		Time: 47MSLanguage: G++		Result: AcceptedSource Code#include 
#include
#include
using namespace std;int t,m;string str[11];string rlt;string tmp;int main(){ scanf("%d",&t); while(t--) { scanf("%d",&m); for(int i=0;i
>str[i]; } rlt=""; for(int l=3; l<=60; l++) { for(int i=0; i<=60-l;i++) { tmp=str[0].substr(i,l); bool isFind=true; for(int k=1; k
rlt.size()) { rlt=tmp; } else if(isFind && tmp.size()==rlt.size() && tmp

  

转载于:https://www.cnblogs.com/eric-blog/archive/2012/05/02/2479842.html

你可能感兴趣的文章
浅谈UI自动化测试
查看>>
认证模式之Spnego模式
查看>>
对象逆序列化报错:java.lang.ClassNotFoundException
查看>>
iOS - UITableView加载网络图片 cell适应图片高度
查看>>
DocFX生成PDF文档
查看>>
运营活动需求实现
查看>>
代理(Proxy)和反射(Reflection)
查看>>
隐藏当前Activity而不关闭
查看>>
第三百四十一节,Python分布式爬虫打造搜索引擎Scrapy精讲—编写spiders爬虫文件循环抓取内容—meta属性返回指定值给回调函数—Scrapy内置图片下载器...
查看>>
温故而知新-String类
查看>>
JS控制div跳转到指定的位置的几种解决方案总结
查看>>
《图说VR》——HTC Vive控制器按键事件解耦使用
查看>>
【Java学习笔记之十一】Java中常用的8大排序算法详解总结
查看>>
android studio使用真机测试时点击Debug调试模式时报Error running app:No target device found,点击运行模式却是启动正常的...
查看>>
洛谷 P1553 数字反转(升级版)【字符串+STL stack】
查看>>
【javascript】异步编年史,从“纯回调”到Promise
查看>>
C# WinForm开发系列 - Form/Window
查看>>
python 读取单所有json数据写入mongodb(单个)
查看>>
ZooKeeper可视化Web管理工具收集(待实践)
查看>>
linux pthread【转】
查看>>