POJ_1007_DNA Sorting
来源:互联网 发布:软件核心技术及创新点 编辑:程序博客网 时间:2024/05/17 20:00
#include<stdio.h>#include<stdlib.h>int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b; }int main(){int n, m, a, c, g;char str[100][51], temp[51];int count[100] = { 0 };scanf("%d%d", &n, &m);for (int i = 0; i < m; i++){scanf("%s", str[i]);a = c = g = 0;for (int j = n - 1; j >= 0; j--) {switch (str[i][j]){case'A': a++; break;case'C': c++; count[i] += a; break;case'G': g++; count[i] += a + c; break;default: count[i] += a + c + g; break;}}count[i] = count[i] * 100 + i;//用个、十位存储字符串的秩}qsort(count, m, sizeof(int), cmp);for (int i = 0; i < m; i++)printf("%s\n", str[count[i] % 100]);return 0;}
0 0
- POJ_1007_DNA Sorting
- Sorting
- Sorting:
- Sorting
- Sorting
- Sorting
- Sorting
- Sorting
- GridView sorting
- java sorting
- java sorting
- insert-sorting
- DNA Sorting
- DNA Sorting
- Sorting Algorithms
- DNA Sorting
- DNA Sorting
- DNA Sorting
- POJ 1568 Find the Winning Move(极大极小搜索+alpha-beta剪枝)
- SCU - 4444 别样最短路径-大数据完全图
- 【2016年总】——蜕变,总在不经意间
- Never underestimate the heart of a champion
- keep on coding 8.26-2-2
- POJ_1007_DNA Sorting
- 盒子模型
- 浅克隆和深克隆
- 段寄存器和8种地址寻址方式
- 三,Node.js基础知识(1)
- 陈志武:美国名牌大学金融系为何停招中国学生?
- python 学习(二十)之模块
- poj 2331
- 还在用Not in为什么不用 join