描述

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. 数独·唯一性技巧(Uniqueness)-1

    唯一性技巧基于这样一个事实——各类出版物上发布的数独题目都只有唯一解.事实上,绝大多数数独玩家有这样的共识:即合格的数独题目解应该是唯一的.因此,为了保证题目合格.有效,出题者在制作题目时,会将一些虽 ...

  2. Abp使用不同仓储连接多个数据库

    有群友说官方例子中有,无奈英文和网速太差...自己琢磨吧. 最近开发的项目中,需要从外部系统中读取一些信息,计算之后存入本地的数据库中,外部系统直接提供数据库给我..所以本地需要用到多数据库连接. 项 ...

  3. Task 回调

    前正无生意,且记录Task回调之用法. using System; using System.Collections.Generic; using System.Diagnostics; using ...

  4. 利用find同时查找多种类型文件

    find . -name "*.c" -o -name "*.cpp" -o -name "*.h" 就可以列出当前目录下面所有的c,cpp ...

  5. javascript 文件的操作

    js 文件的操作(ActiveXObject仅支持IE) 一.参数解释: 1. filename: filename //文件路径 2.iomode: var forReading=1;只读var f ...

  6. slowhttptest安装及使用

    slowhttptest简介: Slowhttptest是依赖HTTP协议的慢速攻击DoS攻击工具,设计的基本原理是服务器在请求完全接收后才会进行处理,如果客户端的发送速度缓慢或者发送不完整,服务端为 ...

  7. Maven国内源设置阿里云地址

    Maven国内源设置 目前国外的maven源访问非常慢,作为一个Java开发者,是一件很痛苦的事,而国内的maven源,oschina已经关闭,目前最好的方式,就是使用阿里云的镜像: <mirr ...

  8. UML之类图详解

    原文链接:https://www.cnblogs.com/xsyblogs/p/3404202.html 我们通过一个示例来了解UML类图的基本语法结构.画UML类图其实有专业的工具,像常用的Visi ...

  9. 浅谈HTTP和TCP的理解

    TCP协议对应于传输层,而Http协议对应于应用层,Http协议是建立在TCP协议之上的,当浏览器需要从服务器获取网页数据的时候,会发出一次Http请求.HTTP会通过TCP建立一个连接通道,当HTT ...

  10. asp.net MVC中的@model与Model

    asp.net MVC中的@model与Model https://blog.csdn.net/ydm19891101/article/details/44301201 在MVC的实际使用中,我们经常 ...