标签:cout str max node 一个 script inf 四种 mes
10 6 AACATGAAGG TTTTGGCCAA TTTGGCCAAA GATCAGATTT CCCGGGGGGA ATCGATGCAT
CCCGGGGGGA AACATGAAGG GATCAGATTT ATCGATGCAT TTTTGGCCAA TTTGGCCAAA
#include<bits/stdc++.h> using namespace std; #define ll long long #define eps 1e-9 const int inf = 0x3f3f3f3f; const int mod = 1e9+7; const int maxn = 100000 + 8; int n, m; char c[1000 + 8][1000 + 8]; struct node { char c[1000 + 8]; int num, id; }a[1000 + 8]; bool cmp(node a, node b) { if(a.num != b.num) return a.num < b.num; return a.id < b.id; } int main() { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>m; for(int i = 0; i < m; i++) { a[i].num = 0; for(int j = 0; j < n; j++) { cin>>c[i][j]; a[i].c[j] = c[i][j]; a[i].id = i; } } for(int i = 0; i < m ; i++) for(int j = 0; j < n - 1; j++) for(int k = j + 1; k < n; k++) if(c[i][j] > c[i][k]) a[i].num++; sort(a, a + m, cmp); for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) cout<<a[i].c[j]; cout<<‘\n‘; } return 0; }
标签:cout str max node 一个 script inf 四种 mes
原文地址:https://www.cnblogs.com/RootVount/p/11420744.html