DNA Consensus String UVA
来源:互联网 发布:des算法破解 编辑:程序博客网 时间:2024/05/01 03:48
https://vjudge.net/problem/19496
这个想法比较有意思。
少数服从多数的感觉。
统计每个位置最多的。
然后空序列那个位置上填上最多的就可以了。
至于数量是不同的加起来就可以了。
#include <iostream>#include <cstring>#include <iomanip>#include <cstdio>#include <string>#include <algorithm>#include <queue>#include <cmath>#include <map>using namespace std;map<char ,int > d;int main(){ int t; cin>>t; while(t--) { int n,m; cin>>n>>m; string a[10005]; for(int i=0;i<n;i++) { cin>>a[i]; } string b; char x; int sum=0; for(int i=0;i<m;i++) { int maxs=0; for(int j=0;j<n;j++)//少数服从多数 { d[a[j][i]]++; if(d[a[j][i]]>maxs) { maxs=d[a[j][i]]; x=a[j][i]; } } b+=x; sum+=n-maxs; d.clear(); } cout<<b<<endl; cout<<sum<<endl; }}
0 0
- DNA Consensus String UVA
- DNA Consensus String UVA
- DNA Consensus String UVA
- DNA Consensus String UVA
- UVA 1368 - DNA Consensus String
- uva 1368 DNA Consensus String
- Uva-1368-DNA Consensus String
- UVa 1368 DNA Consensus String
- UVA 1368 DNA Consensus String
- UVA 1368 DNA Consensus String
- UVa:1368 DNA Consensus String
- uva 1368 - DNA Consensus String
- UVa 1368 - DNA Consensus String
- UVa 1368 - DNA Consensus String
- UVa 1368 DNA Consensus String
- UVa 1368 - DNA Consensus String
- UVA - 1368 DNA Consensus String
- UVa 1368DNA Consensus String
- 005-完成ipl
- python中的operator库
- BestCoder Round#92 1002 Count the Sheep
- log4j详情 以及正确配置
- 【Redis】Redis介绍与Redis3在Window下的安装
- DNA Consensus String UVA
- Git-2.12.0-64-bit .exe下载
- 头文件cctype的函数系列
- PAT 1076-Forwards on Weibo (30)
- 散列表(哈希表)查找算法
- 类继承
- C安全函数整理
- Biorhythms(POJ1006)
- java的多态性