UVA
来源:互联网 发布:揭阳网络广告公司 编辑:程序博客网 时间:2024/06/16 04:27
思路:统计字符的最大值 若有相同的以字典序第一个为准输入
简单题
#include<iostream>#include<cstdio>#include<string>#include<algorithm>using namespace std;int main(){ int T, m, n; int i, j; int a_count = 0, g_count = 0,c_count=0,t_count=0; char DNA[50][10001]; char output[10001]; int min; cin >> T; while (T--) { min = 0; cin >> m >> n; getchar(); for (i = 0; i < m; i++) //输入序列 fgets(DNA[i], n+2, stdin); for (i = 0; i < n; i++) //统计个数 { for (j = 0; j < m; j++) { switch (DNA[j][i]) { case 'A': a_count++; break; case 'G': g_count++; break; case 'C': c_count++; break; case 'T': t_count++; break; } } if (a_count >= c_count&&a_count >= g_count &&a_count >= t_count) { output[i] = 'A'; min += (m - a_count); } if (c_count >= g_count &&c_count >= t_count&&c_count > a_count) { output[i] = 'C'; min += (m - c_count); } if (g_count >= t_count&&g_count > a_count&&g_count > c_count) { output[i] = 'G'; min += (m - g_count); } if (t_count > a_count&&t_count > g_count&&t_count > c_count) { output[i] = 'T'; min += (m - t_count); } a_count = 0; g_count = 0; c_count = 0; t_count = 0; } for (i = 0; i < n; i++) printf("%c", output[i]); printf("\n%d\n", min); } return 0;}
阅读全文
0 0
- uva
- UVA
- UVA
- UVA
- uva
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- [codeforces208E]Blood Cousins(dsu on the tree+倍增)
- hdu 4821 String(hash)
- abc
- Android O中Notification 的修改与其使用错误
- what a fuck!这是什么鬼东西?
- UVA
- 欧拉函数求和
- leetcode 363. Max Sum of Rectangle No Larger Than K 动态规划DP + 暴力循环
- POJ 2186 Popular Cows 笔记
- 如何解决maven搭建项目的时候,src/main/java无法建立的问题,提示信息The folder is already a source folder.
- qt不同窗口之间的切换
- 简单利用RecyclerView实现ListView的点击事件
- Could not load TestContextBootstrapper [null]. Specify @BootstrapWith's 'val
- ie的png透明图片兼容性问题