DNA Consensus String】的更多相关文章

UVA 11636 Hello World 二的幂答案就是二进制长度减1,不是二的幂答案就是是二进制长度. #include<cstdio> int main() { ; ){ ; ) r++; printf("Case %d: %d\n",++kas,r); } ; } LA 3602 DNA Consensus String 贪心构造,每一位上选出现次数最多的. #include<bits/stdc++.h> using namespace std; ,ma…
<tex2html_verbatim_mark> Figure 1. DNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It consists of four different nucleotides, namely Adenine, Thymine, Guanine, and Cytosine as shown in Figure 1. If we represent a…
题目(中英对照): DNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It consists of four different nucleotides, namely Adenine, Thymine, Guanine, and Cytosine as shown in Figure 1. If we represent a nucleotide by its initial…
DNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It consists of four different nucleotides, namely Adenine, Thymine, Guanine, and Cytosine as shown in Figure 1. If we represent a nucleotide by its initial character…
这道题挺简单的,刚开始理解错误,以为是从已有的字符串里面求最短的距离,后面才发现是求一个到所有字符串最小距离的字符串,因为这样的字符串可能有多个,所以最后取最小字典序的字符串. 我的思路就是求每一列每个基因A.C.G.T的数量,找到最大值,最大值可能不止一个,但是锁定字典序最小的那个为所求字符串当前列的值,求解实例如下所示 TATGATACTAAGCTACAAAGATCCTGAGATACTAAGATGT 对于上述字符串,第一列A,C,G,T的值分别为1,0,0,4,可见最大值为4,说明当前列到每…
https://vjudge.net/problem/UVALive-3602 题意: 给定m个长度均为n的DNA序列,求一个DNA序列,使得它到所有的DNA序列的汉明距离最短,若有多个解则输出字典序最小的解. ps:汉明距离指的是两个等长字符串中字符不同的位置的个数. 思路: 贪心原则,记录每一个位置上哪个字母出现的次数最多,如果有相同的就取字典序最小的那个,然后放进答案就可以了. 代码: #include <iostream> #include <string> #includ…
#include <stdio.h>#include <string.h> int main(){    int a[4][1000]; // A/C/G/T在每列中出现的次数    char c, x;    char bas[4] = { 'A', 'C', 'G', 'T' };    int T, m, n, i, j, k, dist;    scanf("%d", &T);    while (T--)    {        scanf(&…
https://cn.vjudge.net/problem/UVA-1368 二维的hamming距离算法: For binary strings a and b the Hamming distance is equal to the number of ones (population count) in a XOR b. int hamming_distance(unsigned x, unsigned y) { ; unsigned val = x ^ y; // Count the n…
题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1603 题意 问使m个n长碱基序列汉明码最小的序列 思路 明显,取最频繁的 代码 #include <algorithm> #include <cassert> #include <cmath> #include <cstdio&…
题意:给定m个长度为n的DNA序列,求一个最短的DNA序列,使得总Hamming距离最小. Hamming距离等于字符不同的位置个数. 析:看到这个题,我的第一感觉是算时间复杂度,好小,没事,完全可以暴力,只要对每个串的同一个位置, 都选出现最多的,如果有一样的选ASIIC码小的(因为要求字典序小).然后记录最字符和Hamming距离即可. 代码如下: #include <iostream> #include <cstdio> #include <algorithm>…