Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
146975 hjx22222 分割排序 C++ Runtime Error 0 MS 396 KB 1130 2026-02-01 16:09:14

Tests(0/1):


Code:

#include <bits/stdc++.h> using namespace std; int main() { string a; int i,j,k,m,n,f,t; while(cin>>a) { n=a.size(); i=0; j=0; char b[501][1001],temp[1001]; while(i<n) { if(a[i-1]=='5' or i==0) { if(a[i]=='0') { t=i; while(a[t]!='5' and a[t]=='0') a[t++]=' '; } } if(a[i]=='5' and a[i-1]==' ') a[i-1]='0'; i++; } //printf("%s\n",a); i=0; while(i<n) { f=0; while(true) { if(a[i]!=' ' and a[i]!='5') b[j][f++]=a[i]; i++; if(a[i]=='5') { b[j][f]='\0'; j++; break; } } i++; } n=j; //printf("%d\n",n); i=0; while(i<n-1) { j=i; while(j<n) { if(strlen(b[j])<strlen(b[i])) { strcpy(temp,b[j]); strcpy(b[j],b[i]); strcpy(b[i],temp); } else if(strlen(b[j])==strlen(b[i]) and strcmp(b[j],b[i])<0) { strcpy(temp,b[j]); strcpy(b[j],b[i]); strcpy(b[i],temp); } j++; } i++; } i=0; while(i<n) printf("%s ",b[i++]); printf("\n"); } return 0; }


Run Info:

Runtime Error:Segmentation fault