描述

How can millions of different and complex structures be built using only a few simple building blocks? Just ask your DNA. DNA (short for deoxyribonucleic acid) spells out the genetic codes of millions of species, using just four molecules: adenine (A), guanine (G), thymine (T), and cytosine (C). These molecules are called nucleotide bases. Different sequences of nucleotide bases are what define each species.
Within
this coil of DNA lies all the information needed to produce everything
in the human body. A strand of DNA may be millions, or billions, of
base-pairs long. Different segments of the DNA molecule code for
different characteristics in the body. A Gene is a relatively small
segment of DNA that codes for the synthesis of a specific protein. This
protein then will play a structural or functional role in the body. A
chromosome is a larger collection of DNA that contains many genes and
the support proteins needed to control these genes.


Now
, we give you the Sequence of some genes, which code for different
proteins. And then we give every protein a score.here comes your
problem,if we give you a chromosome in sequence , of course it can code
many proteins, can you arrange which proteins it code , with the object
to get The largest score (two proteins can not be overlap).

输入

There
will be several testcases. For each testcase, the first line is an
integer N(1 < N ≤ 100,000), the number of the genes we will give you.
Then followed N lines , each line contains a string S(the lenth of S is
no more than 10), the sequence of the gene , and an integer C, the
score of the protein the gene code. The last line of each testcase is a
string (the length of this string is no more than 1000), describes the
sequence of the chromosome.

输出

For each testcase , output the largest score in the sample’s format.

样例输入

4
AATG 3
AT 2
GCGG 3
GG 2
AATGCGG
3
A 1
C 1
G 1
T

样例输出

Case 1: 5
Case 2: 0

题目来源

HNU 2009

dp[i+l]=max(dp[i]+M[temp]),M[temp]表示某基因的score值。

大量输入输出使用scanf。

#include <stdio.h>
#include <string>
#include <map>
#include <iostream>
using namespace std; int main(int argc, char *argv[])
{
int t,c=;
int dp[];
while(scanf("%d",&t)!=EOF){
char gene[];
int score;
map< string,int > M;
memset(dp,,sizeof(dp));
for(int i=; i<=t; i++){
scanf("%s %d",gene,&score);
M[gene]=score;
}
string g;
cin>>g;
int len=g.size();
for(int i=; i<len; i++){
for(int l=; l<=; l++){
if(l+i>len)continue;
string temp=g.substr(i,l);
if(dp[i+l] < dp[i]+M[temp]){
dp[i+l]=dp[i]+M[temp];
}
}
}
int ans=-;
for(int i=; i<=len; i++){
if(dp[i]>ans)
ans=dp[i];
}
printf("Case %d: %d\n",++c,ans);
}
return ;
}

TOJ 2641 Gene的更多相关文章

  1. TOJ 2776 CD Making

    TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性...  贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题 ...

  2. KEGG and Gene Ontology Mapping in Bioinformatic Method

    使用KOBAS进行KEGG pathway和Gene Ontology分析 Article from Blog of Alfred-Feng http://blog.sina.com.cn/u/170 ...

  3. 合并基因表达水平(merge gene expression levels, FPKM)

    使用tophat和cufflinks计算RNA-seq数据的表达水平时,当一个基因在一个样本中有多个表达水平时需要合并它们的表达水平. This code is a solution to colla ...

  4. augustus, gene prediction, trainning

    做基因组注释 先用augustus训练,然后再用maker做基因注释 augustus提供一些训练好的,如果有和你的物种非常接近的,直接用提供的,没有的话再自己训练. 网址: http://bioin ...

  5. gene框架文档 - 路由类 gene_router

    路由类 Gene\Router 介绍 Gene\Router 是gene框架的核心类之一,本框架区别于其他常见框架的最大地方就是独特.强大.简单的路由定义等.路由强大灵活,支持回调.类方法:支持res ...

  6. gene框架文档 - 概述

    欢迎使用Gene框架 最新版本:V1.2.2 开源地址:https://github.com/sasou/php-gene 作者:sasou 文档地址:http://php-gene.com/doc ...

  7. Human Gene Functions

    Human Gene Functions Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18053 Accepted: 1004 ...

  8. POJ 1080 Human Gene Functions -- 动态规划(最长公共子序列)

    题目地址:http://poj.org/problem?id=1080 Description It is well known that a human gene can be considered ...

  9. poj1080--Human Gene Functions(dp:LCS变形)

    Human Gene Functions Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17206   Accepted:  ...

随机推荐

  1. 2018年第九届蓝桥杯C/C++A组省赛(最后一题)

    第十题 付账问题   [题目描述]    几个人一起出去吃饭是常有的事.但在结帐的时候,常常会出现一些争执.    现在有 n 个人出去吃饭,他们总共消费了 S 元.其中第 i 个人带了 ai 元.幸 ...

  2. day02.1-字符串内置方法

    字符串——str的定义:test = "zizaijiapu" 特点:1. 字符串是可迭代对象: 2. 字符串中各元素是有序的: 3. 字符串一经创建,其内容值不可修改. 1. 查 ...

  3. JVM之类加载机制

    JVM之类加载机制 JVM类加载机制分为五个部分:加载,验证,准备,解析,初始化,下面我们就分别来看一下这五个过程. 类加载五部分 加载 加载是类加载过程中的一个阶段,这个阶段会在内存中生成一个代表这 ...

  4. 【算法】关于图论中的最小生成树(Minimum Spanning Tree)详解

    本节纲要 什么是图(network) 什么是最小生成树 (minimum spanning tree) 最小生成树的算法 什么是图(network)? 这里的图当然不是我们日常说的图片或者地图.通常情 ...

  5. c语言数据结构学习心得——排序

    排序:将无序的序列重新排列为有序的序列. 插入类排序 插入类排序:在一个有序的序列中,插入一个新的关键字,知道所有的关键字都插入形成一个有序的序列. 直接插入排序:首先以一个元素为有序的序列,然后将后 ...

  6. C++_类入门4-String类

    很多应用程序都需要处理字符串.C语言在string.h(C++中为cstring)中提供了一系列的字符串函数,很多早期的C++实现为处理字符串提供了自己的类. string类是由头文件string支持 ...

  7. 【原创】elasticsearch入门

    示例 示例一: 示例二: 示例三: 示例四: ES介绍 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Ela ...

  8. 一款不错的Linux终端颜色设置

    PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[36;40m\]\w\[\e[0m\]]\\$ " #步骤# vi ...

  9. windows cmd 切换磁盘

    抛砖引玉 切换到D盘根目录——cd /d D: 切换到D:\dev目录——cd  /d  D:\dev

  10. 洛谷 P2147 [SDOI2008]洞穴勘测 (线段树分治)

    题目链接 题解 早就想写线段树分治的题了. 对于每条边,它存在于一段时间 我们按时间来搞 我们可把一条边看做一条线段 我们可以模拟线段树操作,不断分治下去 把覆盖\(l-r\)这段时间的线段筛选出来, ...