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 |
一直RunTime,求大神帮吗解释下#include<stdio.h> #include<string.h> #include <stdlib.h> #define Max 11 char str[Max][Max]; char R[Max]; char Q[Max]; int T[Max]; int Sort(char p[][Max],int n,int i){ int o,j,q=0; for(o=0;o<n;o++){ // memset(R,0,sizeof(R)); for(j=o;j<n-1;j++){ //R[j]=P[i][j+1]; if(p[i][o]>p[i][j+1]){ q++; } } } return q; } int Sort2(int e){ int i,min,j=0; min = T[0]; for(i=1;i<e;i++){ if(min>T[i]){ min=T[i]; j=i; } } T[j]=100; return j; } int main(){ int n,m,i,j=0,k; scanf("%d%d",&n,&m); for(i=0;i<m;i++){ scanf("%s",str[i]); } for(;j<m;j++){ T[j]=Sort(str,n,j); } for(i=0;i<m;i++){ k=Sort2(j); puts(str[k]); } 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