| ||||||||||
| 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 | |||||||||
求助!!!为什么总是Runtime Error ?附程序#include<iostream.h>
#include<string.h>
int main()
{
char a[100][50],b[100],c[50];
int n,m,i,j,count,s,k;
cin>>n>>m;
for(i=0;i<m;i++)
{
count=0;
cin>>a[i];
for(j=0;j<n-1;j++)
for(k=j+1;k<n;k++)
{
if(a[i][j]>a[i][k])
count++;
}
b[i]=count;
}
for(i=0;i<m-1;i++)
{
s=b[i+1];
strcpy(c,a[i+1]);
j=i;
while(j>-1&&s<b[j])
{
b[j+1]=b[j];
strcpy(a[j+1],a[j]);
j--;
}
b[j+1]=s;
strcpy(a[j+1],c);
}
for(i=0;i<m;i++)
cout<<a[i]<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator