| ||||||||||
| 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 | |||||||||
怎样可以缩短时间咧,大牛们,帮帮忙啊#include<stdio.h>
void main()
{char a[100][50];
int p[100]={0};
int i,j,k,m,n,temp;
scanf("%d%d",&m,&n);
for(i=0;i<m;i++)
scanf("%s",a[i]);
for(i=0;i<m;i++)
{
for(j=0;j<n-1;j++)
for(k=j;k<n;n++)
if(a[i][j]>a[i][k])p[i]++;
}
for(i=0;i<m;i++)
{temp=i;
for(j=0;j<m;j++)
if(p[j]<p[temp])temp=j;
printf("%s\n",a[temp]);
p[temp]=1000;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator