| ||||||||||
| 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 | |||||||||
怎么一直是WA?找不到原因 求助呀!!!!!!!!!!!谢谢了!!!!!!!!!1#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int a,b,t;
int i,j,k,l;
scanf("%d%d",&a,&b);
char s[b][a],p[b][2],ch;
for(i=0;i<b;i++)
scanf("%s",s[i]);
for(k=0;k<b;k++)
p[k][0]=0;
for(i=0;i<b;i++)
{ l=0;
p[i][1]=i;
for(j=0;j<a-1;j++)
for(k=j+1;k<a;k++)
if(s[i][j]>s[i][k]) l++;
p[i][0]=l;
}
for(i=1;i<b;i++)
for(k=0;k<b-1;k++)
if(p[k][0]>p[k+1][0])
{t=p[k][0];p[k][0]=p[k+1][0];p[k+1][0]=t;
t=p[k][1];p[k][1]=p[k+1][1];p[k+1][1]=t;}
for(i=0;i<b;i++)
{t=p[i][1];
for(j=0;j<a;j++)
printf("%c",s[t][j]);
printf("\n");
}
system("PAUSE");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator