poj 1007 DNA Sorting
2016-12-06 20:00
417 查看
poj 1007 DNA Sorting
题意:将字符串以逆序数的大小排序。
题解:rt。
题意:将字符串以逆序数的大小排序。
题解:rt。
#include <stdio.h> #include <string.h> #include <math.h> #include <algorithm> #include <iostream> using namespace std; struct xx { char str[51]; int num; }a[101]; int cmp(xx a,xx b) { return a.num < b.num; } int main() { int n,m; while(~scanf("%d%d",&n,&m)) { for(int i = 0; i < m; i++) { scanf("%s",a[i].str); for(int j = 0; j < n - 1; j++) { for(int k = j + 1; k < n; k++) { if(a[i].str[j] > a[i].str[k]) a[i].num++; } } } sort(a,a+m,cmp); for(int i = 0; i < m; i++) { printf("%s\n",a[i].str); } } return 0; }
相关文章推荐
- POJ 1007 DNA Sorting
- poj 1007 DNA Sorting(简单题)
- poj 1007 DNA Sorting
- poj 1007 DNA Sorting 解题报告
- 【原】 POJ 1007 DNA Sorting 逆序数 解题报告
- poj 1007 DNA Sorting【逆序对】
- poj 1007 DNA Sorting (求逆序数)
- poj 1007 DNA Sorting
- poj 1007 DNA Sorting
- poj-1007 DNA sorting
- POJ 1007 DNA Sorting(sort函数的使用)
- 算法:POJ1007 DNA sorting
- POJ 1007 DNA Sorting
- 【POJ】1007 DNA Sorting
- poj 1007 DNA Sorting(STL运用)
- POJ1007-DNA Sorting
- POJ 1007 DNA Sorting
- POJ 1007 DNA Sorting
- POJ 1007 DNA Sorting
- poj1007——DNA Sorting