#include<stdio.h> #include<string.h> #include<stdlib.h> int a[1005]; char s[1005]; char *temp; int cmp(const void *a,const void *b){ return *(int*)a-*(int*)b; } int main() { int k,i; while(gets(s)){ a[0]=atoi(strtok(s,"5")); k=1; while(temp=strtok(NULL,"5")){ a[k++]=atoi(temp); } qsort(a,k,sizeof(a[0]),cmp); for(i=0;i<k;i++){ if(i==k-1)printf("%d",a[i]); else printf("%d ",a[i]); } printf("\n"); } return 0; }
时间: 2024-10-12 23:32:09