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 |
sigh~~~~,strcmp返回第一个不同字符相减的值,不一定是+-1的In Reply To:为什么?这究竟是为什么? Posted by:Ikki at 2005-07-08 16:56:55 > 天理啊!良心啊!残酷啊! > 我做了半天的程序 > bool cmp(const Type& a,const Type& b) > { > int signal=strcmp(a.sorted,b.sorted); > if(signal!=0) return signal<0; > else return strcmp(a.original,b.original)<0; > /* > int ans=strcmp(a.sorted,b.sorted); > if(ans==-1) return true; > else if (ans==1) return false; > else > { > int ans1=strcmp(a.original,b.original); > if (ans1==1) return false; > else return true; > } > */ > } > > 把cmp改成注释中的内容就TLE > 这样写就AC…… > 为什么? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator