| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么是RUNTIMR ERROR????求救啊,我快崩溃啦!!1#include <stdio.h>
main()
{int x,y,i,j,d[100],t,z=0;
char a[100][51],b[100][51],temp;
scanf("%d",&y);
scanf("%d",&x);
for(i=0;i<x;i++)
{scanf("%s",&a[i]);
strcpy(b[i],a[i]);}
for(i=0;i<x;i++)
{ for(d[i]=0,t=y;t>=z;t--)
for(j=y-1;j>z;j--)
if(b[i][j]<b[i][j-1])
{temp=b[i][j];
b[i][j]=b[i][j-1];
b[i][j-1]=temp;
d[i]++;}
}
for(i=0;i<x-1;i++)
{for(j=i+1;j<x;j++)
if(d[i]>d[j])
{t=d[i];
d[i]=d[j];
d[j]=t;
strcpy(temp,a[i]);
strcpy(a[i],a[j]);
strcpy(a[j],temp);
}
}
for(i=0;i<x;i++)
printf("%s\n",a[i]);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator