poj 1007
来源:互联网 发布:互联网大数据分析 编辑:程序博客网 时间:2024/05/24 03:47
#include<iostream>#include<fstream>#include<algorithm>#include<vector>using namespace std;struct node{ string s; int val;};bool comp(const node &node1,const node &node2){ return node1.val<=node2.val;}int main(){ //ifstream cin("1.txt"); int n,m; cin>>n>>m; string s; vector<node> vnode; for(int i=0;i<m;++i){ cin>>s; node nod; nod.s=s; int val=0; for(int k=0;k<s.length();++k) for(int j=k+1;j<s.length();++j){ if(s[k]>s[j]) val++; } nod.val=val; vnode.push_back(nod); } sort(vnode.begin(),vnode.end(),comp); for(int i=0;i<vnode.size();++i) cout<<vnode[i].s<<endl; return 0;}
0 0
- POJ 1007
- poj 1007
- poj 1007
- POJ 1007
- POJ 1007
- poj 1007
- POJ-1007
- POJ 1007
- poj 1007
- POJ 1007
- POJ-1007
- poj-1007
- POJ 1007
- poj 1007
- POJ 1007
- POJ 1007
- poj 1007
- POJ 1007
- 最大子段和
- 排序算法汇总
- 八卦一下模型验证(三) (g9老大的八卦系列)
- vs2010 “系统找不到指定文件”问题
- Object-C中对自定义类实现<NSCopying>协议
- poj 1007
- perl的几个小知识点
- English in The World
- Oracle安装(2)通过SHELL脚本快速安装Oracle11gR2软件
- 30岁之前创业四次:最大痛苦是知道自己错了
- POJ-2385-Apple Catching
- spring常用jar包详解
- wxFormBuilder怎么制作继承于wxWindow的窗口,便于集成在frame中
- 奇偶页不同页眉页脚设置