Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎样可以缩短时间咧,大牛们,帮帮忙啊

Posted by faof at 2007-04-19 22:23:12 on Problem 1007
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator