POJ1007
来源:互联网 发布:ubuntu 14.04 selinux 编辑:程序博客网 时间:2024/06/06 17:10
题目大意:
思路:分别计算逆序数,然后因为个数太少,可以用冒泡排序,然后输出,记得用结构体
#include<stdio.h>#include<string.h>#define M 200struct dna{char str[M];int ans;};struct dna d[M];struct dna t;void main(){int n,m,i,j,k;scanf("%d%d",&n,&m);for(i=0;i<m;i++){scanf("%s",d[i].str);d[i].ans=0;for(j=0;j<n;j++){for(k=j;k<n;k++)if(d[i].str[j]>d[i].str[k])d[i].ans++;}}for(i=0;i<m;i++)for(j=i;j<m;j++){if(d[i].ans>d[j].ans){t=d[i];d[i]=d[j];d[j]=t;}}for(i=0;i<m;i++){printf("%s\n",d[i].str);}}
0 0
- poj1007
- POJ1007
- poj1007
- POJ1007
- poj1007
- POJ1007
- poj1007
- poj1007
- poj1007
- POJ1007
- poj1007
- poj1007
- POJ1007
- poj1007
- Poj1007
- poj1007
- poj1007
- POJ1007
- javascript:void(0)
- Eclipse快捷键 10个最有用的快捷键
- 超越线程池:Java并发并没有你想的那么糟糕 http://developer.51cto.com/art/201503/469648.htm
- java 位运算符
- 基于libsvm的中文文本分类原型
- POJ1007
- Dispatcher介绍
- 超级Log设想
- Caused by: android.view.InflateException: You must specifiy a layout in the include tag: <include la
- oracle 11g归档日志研究_2
- C语言内存分配函数
- Java BitSet笔记
- Android之Monkey全参数(包含隐藏参数)
- POJ 1129 Channel Allocation(DFS + 四色定理)