# 排序

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 41261    Accepted Submission(s): 11824

Problem Description

Input

Output

Sample Input
0051231232050775

Sample Output
0 77 12312320

Source

Recommend
Eddy   |   We have carefully selected several similar problems for you:  1108 1201 1040 1280 1002

505123123205077555
0 77 12312320
00005051231232050775
0 0 77 12312320
50512312320555507750005
0 0 77 12312320
505123123205077
0 77 12312320
051231232055077
0 77 12312320
5550
0
1155663535006555
3 6 11 663
10000000055051120
0 1120 100000000
00060054
4 600

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main(){
char str[1005];
int a[1005],i,k,len;
while(~scanf("%s",str)){
len=strlen(str);
k=0;
memset(a,0,sizeof(a));
for(i=0;i<len;){  //  这里不要自加一
while(str[i]=='5')
i++;  //  去头为5
while(str[i]!='5'&&i<len){
a[k]=a[k]*10+str[i]-'0';
i++;
}
while(str[i]=='5'&&i<len)
i++;  //去尾为5
if(i<len) k++;  //  判断是否还有可存储的数，要开数组单元
}   //  存储数据
sort(a,a+k+1);
if(k>0){
printf("%d",a[0]);
for(i=1;i<=k;i++)
printf(" %d",a[i]);
}
else printf("%d",a[0]);
printf("\n");
}
return 0;
}


#### 杭电acm1106

2015-03-10 11:11:22

#### HDOJ 1106 排序 （字符串处理）

2013-04-18 00:11:47

#### 杭电ACM1106排序Java代码

2015-10-14 15:42:46

#### 1106排序

2015-07-23 11:10:49

#### 杭电ACM—1106 排序

2016-08-06 11:38:24

#### HDU1106 排序（解法二）（废除！！！）

2016-06-16 06:09:12

#### hdoj 1106 排序

2015-01-16 21:36:11

#### HDOJ 1106 排序

2013-06-22 17:07:24

#### hdoj 1106 排序

2015-07-23 21:12:54

#### HDOJ 1106 排序 [stable_sort]

2009-10-28 13:55:00