| ||||||||||
| 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 | |||||||||
我想找一个argforever学哥学哥:
你好!我想向你请教一下1007的题目。我在acm里面运行错误。下面是我的源代码
#include<stdio.h>
#include<string.h>
char a[101][51];
int order[101];
void main(void)
{
int m,n,i,j,k,unsortedness,temp1,temp2;
scanf("%d%d",&n,&m);
for(i=0;i<m;i++)
{
scanf("%s",a[i]);
unsortedness=0;
for(j=0;j<n-1;j++)
{
for(k=j+1;k<n;k++)
if(a[i][j]>a[i][k])
unsortedness++;
}
order[i]=unsortedness;
}
for(i=0;i<m;i++)
{
temp1=5000;
temp2=-1;
for(j=0;j<m;j++)
{
if(order[j]<temp1)
{
temp1=order[j];
temp2=j;
}
}
order[temp2]=5001;
printf("%s\n",a[temp2]);
}
}
结果为wrong answer
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator