POJ1007
来源:互联网 发布:java入门123 编辑:程序博客网 时间:2024/05/16 06:32
依旧水题
#include "iostream"#include "cstdlib"using std::cin;using std::cout;using std::endl;struct AL{char * Line;short Mse;};int compare(const void *a,const void *b){return ((AL*)a)->Mse - ((AL*)b)->Mse;}void GetMse(short &Len,AL &Str){char id,ix;for( ix = 0 ; ix < Len - 1 ; ix ++ ){for( id = ix + 1 ; id < Len ; id ++ ){if(Str.Line[ix] > Str.Line[id]){Str.Mse ++;}}}}int main(void){short Len,Lin;char i;cin >> Len >> Lin;AL * Str = new AL[Lin];for( i = 0 ; i < Lin ; i ++ ){Str[i].Line = new char[Len + 1];cin >> Str[i].Line;Str[i].Mse = 0;GetMse(Len,Str[i]);}qsort(Str,Lin,sizeof(Str[0]),compare);for( i = 0 ; i < Lin ; i ++ ){cout << Str[i].Line << endl;delete []Str[i].Line;}return 0;}
- poj1007
- POJ1007
- poj1007
- POJ1007
- poj1007
- POJ1007
- poj1007
- poj1007
- poj1007
- POJ1007
- poj1007
- poj1007
- POJ1007
- poj1007
- Poj1007
- poj1007
- poj1007
- POJ1007
- 转啊转
- IBM的LPI复习资料之LPI101-Topic101:系统体系结构(1)Boot the system
- 经典段落
- 7.2.1(按照字典序全排列)
- linux调度器(二)——CFS模型
- POJ1007
- Struts2教程二——Hello World Using Struts 2
- POJ1046
- linux调度器(三)——周期性调度器与CFS
- POJ1061
- POJ1077八数码问题哈希,bfs
- linux调度器(四)——主调度器与CFS
- 新东方六级12-12
- linux调度器(五)——进程管理与CFS