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

是codebest吗?

Posted by yygy at 2014-10-13 21:29:20 on Problem 1007
In Reply To:CB上运行没错……为啥就是说compile error……求助,谢谢 Posted by:201430340222 at 2014-10-13 21:19:53
> #include<stdio.h>
> #include<string.h>
> int main()
> {
>    int sl,sn,i,j,k,p,m,n;
>    scanf("%d %d",&sl,&sn);
>    getchar();
>    int z[sn];
>    char s[sn][sl+1],w[sl+1];
>    for(i=0;i<sn;i++) {
>       j=0;z[i]=0;
>          while((s[i][j]=getchar())!='\n') j++;
>          s[i][j]='\0';
>          for(m=0;m<sl;m++){
>                for(n=m+1;n<sl;n++) {
>                      if(s[i][m]>s[i][n]) z[i]++;
>                }
>          }
>    }
>    for(i=0;i<sn;i++) {
>       k=z[i];
>          for (j=i+1;j<sn;j++) {
>                if(k>z[j]) {k=z[j];p=j;}
>          }
>          if(p!=i) {
>                k=z[i];z[i]=z[p];z[p]=k;
>                strcpy(w,s[i]);strcpy(s[i],s[p]);strcpy(s[p],w);
>          }
>    }
>    for(i=0;i<sn;i++) printf("%s\n",s[i]);
>    return 0;
> }

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