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 |
Re:所有测试数据通过无任何异常,谁能告诉我,为什么runtime error?!!!?!!!In Reply To:所有测试数据通过无任何异常,谁能告诉我,为什么runtime error?!!!?!!! Posted by:yuanshi at 2006-09-13 02:22:57 > #include<iostream> > #include<fstream> > using namespace std; > typedef struct > { > int key; > int xiabiao; > }dna; > > dna hehe[58]; > int n,m; > > > int cmp( const void *a ,const void *b) > { > return ((dna*)a)->key - ((dna*)b)->key ; > } > int main() > { > //ifstream cin("1007.in"); > //ofstream cout("1007.out"); > int i,j,r,k; > char s[108][58]; > cin>>n>>m; > for(i=0;i<m;i++) > cin>>s[i]; > if(m==1) > { > cout<<s[0]<<endl; > return 0; > } > for(i=0;i<m;i++) > { > for(r=0,j=0;j<n;j++) > { > for(k=j+1;k<n;k++) > if(s[i][j]>s[i][k]) > r++; > } > hehe[i].key=r; > hehe[i].xiabiao=i; > } > qsort(hehe,m,sizeof(hehe[0]),cmp); > > for(i=0;i<m;i++) > { > j=hehe[i].xiabiao; > cout<<s[j]<<endl; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator