UVa1368 DNA Consensus String
2015-09-09 14:04
519 查看
#include <stdio.h> char s[51][1001]; char compareA(int countA, int countC, int countG, int countT) { int temp = countT; char c = 'T'; if(temp <= countG) { temp = countG; c = 'G'; } if(temp <= countC) { temp = countC; c = 'C'; } if(temp <= countA) { temp = countA; c = 'A'; } return c; } int main() { int num = 0; int m, n; scanf("%d", &num); while(num--) { scanf("%d %d", &m, &n); for(int i=0; i<m; i++) { scanf("%s",s[i]); } int countA=0, countC=0, countG=0, countT=0; char temp; int total = 0; int all = 0; for(int i = 0; i < n; i++) { countA=0, countC=0, countG=0, countT=0; for(int j = 0; j < m; j++) { if(s[j][i] == 'A') countA++; else if(s[j][i] == 'C') countC++; else if(s[j][i] == 'G') countG++; else if(s[j][i] == 'T') countT++; } temp = compareA(countA, countC, countG, countT); total = countA + countC + countG + countT; if(temp == 'A') total -= countA; else if(temp == 'C') total -= countC; else if(temp == 'G') total -= countG; else if(temp == 'T') total -= countT; all += total; printf("%c", temp); } printf("\n"); printf("%d\n", all); } return 0; }
相关文章推荐
- 从管理国家领悟大厅类游戏架构。
- 如何在CentOS的单用户模式下修改root的密码
- 对象复制
- 得到view的信息以及 view绘制流程解析(二)
- SqlServer表格卡死问题--事务问题
- sqlServer中修复有问题的表
- 非正常结束weblogic进程导致weblogic无法启动
- [SD心灵鸡汤]004.每月一则 - 2015.08
- 文章标题
- Spring AOP使用ASPECTJ错误
- 治风寒感冒 慎吃中成药
- Process Monitor 监控文件访问
- win7 64位上VM虚拟机安装64位Ubuntu14.04.3
- JSON和JSONP 实例
- tomcat配置(ubuntu 14.04 server)
- Win10桌面怎么使用英雄动态壁纸?
- ubuntu14.04搭建LAMP环境(nginx,php,mysql,linux)详解
- 对于Post提交的Flash游戏作弊方法
- 计蒜客 第2题:整除问题
- [转载]Error -27796: Failed to connect to server