标签:ott 开头 else ios amp ++ 分割 tput for
#include<iostream> #include<cstring> using namespace std; int main() { char a[1000][1000],b[1000]; int i=0,j=0,k=0,s,q,w,e=0,r=0,t; int c[1000]; while(cin>>b) { while(b[k]!=‘\0‘) { if(b[k]!=‘5‘){a[i][j]=b[k];j++;k++;} else {a[i][j]=‘\0‘;if(j!=0)i++;j=0;k++;} } a[i][j]=‘\0‘; if(j!=0)i++; for(q=0;q<i;q++) { strcpy(b,a[q]); s=strlen(b); for(w=0;w<s-1;w++) { if(b[w]==‘0‘)e++; else break; } for(w=e;w<s;w++) { a[q][r]=b[w];r++; } a[q][r]=‘\0‘; e=0;r=0; } for(q=0;q<i;q++) { c[q]=strlen(a[q]); } for(q=0;q<i;q++) { for(w=0;w<i;w++) { if(c[q]<c[w]){t=c[q];c[q]=c[w];c[w]=t;strcpy(b,a[q]);strcpy(a[q],a[w]);strcpy(a[w],b);} if(c[q]==c[w]&&strcmp(a[q],a[w])<0){t=c[q];c[q]=c[w];c[w]=t;strcpy(b,a[q]);strcpy(a[q],a[w]);strcpy(a[w],b);} } } for(q=0;q<i-1;q++) { cout<<a[q]<<" "; } cout<<a[q]; cout<<endl; i=0;j=0;k=0; } return 0; }
标签:ott 开头 else ios amp ++ 分割 tput for
原文地址:http://www.cnblogs.com/zengzengzeng/p/6946659.html