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 error 是运行时间超出范围吗?那time limit exceed是什么,附我的程序,不知道为什么总是RE#include<stdio.h> #include<string.h> int main() { char dna[100][50],temp[50]; int num,len,unsort_num[100],i,j,k,t; scanf("%d %d",&len,&num); if (num<=0||num>100||len<=0||len>50) { printf ("input error."); return -1; } for (i=0;i<num;i++) scanf("%s",dna[i]); for (i=0;i<num;i++) { unsort_num[i]=0; for(j=len-1;j>0;j--) for(k=j;k>-1;k--) if (dna[i][j]<dna[i][k]) unsort_num[i]++; } for (i=0;i<num-1;i++) for (j=i;j<num;j++) if (unsort_num[i]>unsort_num[j]) { t=unsort_num[i];unsort_num[i]=unsort_num[j];unsort_num[j]=t; strcpy(temp,dna[i]);strcpy(dna[i],dna[j]);strcpy(dna[j],temp); } for (i=0;i<num;i++) printf("%s\n",dna[i]); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator