#include<bits/stdc++.h> using namespace std; struct node{ char c[35]; int v; node():v(-1){} bool operator < (node& x){ if(v!=x.v)return v<x.v; else return strcmp(c,x.c)<0; } void calc(){ for(int i=0;c[i];i++)if(c[i]>='0'&&c[i]<='9'){ int l=1,u=1; v=0; while(c[i+l]>='0'&&c[i+l]<='9')l++; for(int j=i+l-1;j>=i;j--){ v+=(c[j]-'0')*u; u*=10; } return; } } }all[110]; int main(){ int n=0; while(~scanf("%s",(all+n)->c)){ all[n].calc(); n+=1; } sort(all,all+n); for(int i=0;i<n;i++){ printf("%s ",(all+i)->c); } }
EOJ 2878 Sort
猜你喜欢
转载自www.cnblogs.com/TAMING/p/9207658.html
今日推荐
周排行