DNA Consensus String UVA
来源:互联网 发布:恒生期货软件使用方法 编辑:程序博客网 时间:2024/05/22 04:51
问题类型:字符串,搜索。
03pie’s solution for [UVA-1368]:
#include<cstdio>#include<iostream>#include<sstream>#include<cstdlib>#include<cmath>#include<cctype>//isalpha(),isdigit(),issprint()|toupper(),tolower()#include<string>//strlen()#include<cstring>#include<algorithm>#include<stack>#include<queue>#include<set>#include<map>#include<ctime>#include<vector>#include<fstream>#include<list>using namespace std;#define ms(s) memset(s,0,sizeof(s))typedef unsigned long long ULL;typedef long long LL;const double PI = 3.141592653589;const int INF = 0x3fffffff;#define maxn 1000char c(int i){ if(i==0) return 'A'; if(i==1) return 'C'; if(i==2) return 'G'; if(i==3) return 'T';}char DNAs[maxn][maxn];int main(){// freopen("F://inp.txt","r",stdin); int T; scanf("%d",&T); while(T--) { int count[4]; memset(count,0,sizeof(count)); int row,col; scanf("%d%d",&row,&col); char ans[col]; int anscut=0; getchar(); for(int i=0;i<row;i++) { gets(DNAs[i]); } for(int j=0;j<col;j++) { for(int i=0;i<row;i++) { if(DNAs[i][j]=='A') count[0]++; else if(DNAs[i][j]=='C') count[1]++; else if(DNAs[i][j]=='G') count[2]++; else if(DNAs[i][j]=='T') count[3]++; } int max=count[0],tmp=0; for(int k=1;k<4;k++) { if(count[k]>max) { max=count[k]; tmp=k; } } ans[j]=c(tmp); anscut+=(row-max); memset(count,0,sizeof(count)); } for(int i=0;i<col;i++) printf("%c",ans[i]); printf("\n%d\n",anscut); } return 0;}
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
- hdu 6020 MG loves apple //bc Round #93 1002
- Jmeter使用嵌套循环实现读取2个文件的参数来进行组合参数化
- 计算24点(Java)
- 两个数组求中位数的问题
- 进程上下文和处理器状态切换
- DNA Consensus String UVA
- IOC实现之XML元素解析过程(四)
- 机器学习 ---感知机
- 看看视频解析器1.5
- 2016年上半年信息系统项目管理师真题之上午题小虎趣味解答第16-20题
- Linux下桌面模式切换到命令行模式
- Where is the Marble? UVA
- 基于css3的3D立方体旋转特效 (先translate与先rotate的不同)
- 理解android和linux内核的关系