DNA Consensus String
来源:互联网 发布:网络霸屏 编辑:程序博客网 时间:2024/06/06 08:39
UVa1368
这道题我以为是要求一个串到所有串的距离最小,不过好像可以扩展,但是我好像写不出。
#include <stdio.h>#include <string.h>const int maxn = 1005;char str[maxn][maxn], ch[5] = "ACGT", ans[maxn];int cnt[5];int main ( ){ int T, n, m, value; scanf ( "%d", &T ); while ( T -- ) { value = 0; scanf ( "%d%d", &n, &m ); for ( int i = 0; i < n; i ++ ) scanf ( "%s", str[i] ); for ( int j = 0; j < m; j ++ ) { memset ( cnt, 0, sizeof ( cnt ) ); for ( int i = 0; i < n; i ++ ) { for ( int k = 0; k < 4; k ++ ) if ( str[i][j] == ch[k] ) cnt[k] ++; } int mx = 0, mi = 0; for ( int i = 0; i < 4; i ++ ) if ( mx < cnt[i] ) //ch存放字典序 { mx = cnt[i]; mi = i; } value = value+n-mx; ans[j] = ch[mi]; } ans[m] = '\0'; printf ( "%s\n%d\n", ans, value ); } return 0;}
0 0
- DNA Consensus String
- uva1368 - DNA Consensus String
- Uva1368 DNA Consensus String
- Uva1368 - DNA Consensus String
- UVA1368- DNA Consensus String
- UVA_1368 - DNA Consensus String
- 1368 - DNA Consensus String
- UVaOJ1368 - DNA Consensus String
- DNA Consensus String
- 1368 - DNA Consensus String
- 1368 - DNA Consensus String
- UVA1368 - DNA Consensus String
- DNA Consensus String
- uva1368 - DNA Consensus String
- DNA Consensus String
- DNA Consensus String
- uva1368 - DNA Consensus String
- [UVA1368]DNA Consensus String
- openstack cinder:快照VS备份
- 殷志威<我的第一篇博客>
- Android Binder实列篇
- jsp中的简单文件上传
- 用注册表管理IE代理设置
- DNA Consensus String
- spring注解方式 idea报could not autowire
- 阿里云centos 配置
- 前端设计师必知的background属性(有CSS3内容)
- android屏幕分辨率计算转换
- 加锁的原因 结构体内部增加锁
- MATLAB读取txt的一些方法简单记录
- UIWindow UIScreen UIViewController UIView之间的关系
- oracle中escape的使用