标签:style blog http io ar color os sp for
4 000 00123 12301 1230
0 123 1 123 123
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int test,i,j,len,k,ans,t,c,a[1000],b[1000];
char s[1000];
scanf("%d",&test);
while(test--)
{
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
scanf("%s",s);
len=strlen(s);
for(i=0;i<len;i++)
b[i]=s[i]-'0'; //注意要处理字符串。。。
for(i=0,t=10,j=0;i<len;)
{
k=1;
ans=0;
c=i;
while(b[c]!=0)
{
ans=b[c]+ans*t;
k++;
c++;
}
if(k!=1)
{
a[j]=ans;
j++;
}
i+=k;
}
sort(a,a+j+1);
if(a[j]==0)
printf("0\n");
else{
for(i=1;i<j;i++)
{
printf("%d ",a[i]);
}
printf("%d\n",a[j]);}
}
return 0;
}
标签:style blog http io ar color os sp for
原文地址:http://blog.csdn.net/hdd871532887/article/details/41489923