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 |
又是一菜鸟~~~~~In Reply To:我的也是超时15MS!!!!!!!!!!!!!! Posted by:sunmoon at 2005-10-06 17:12:15 > 我(为了15MS奋斗的人)的也是: > #include <iostream> > #include <stdlib.h> > #include <iomanip> > using namespace std; > int main() > { > int i,j,num,m,flag=1,qq; > cin>>num; > char a[]="22233344455566677778889999",s[100],tt[10]; > long *t=new long[num]; > for(i=0;i<num;i++) > { > cin>>s; > qq=0; > for(j=0;s[j];j++) > { > if (s[j]>='A'&&s[j]<='Z') > tt[qq++]=a[s[j]-'A']; > else if(s[j]>='0'&&s[j]<='9') > tt[qq++]=s[j]; > } > t[i]=atoi(tt); > } > for(i=0;i<num-1;i++) > { > m=i; > for(j=i+1;j<num;j++) > if(t[m]>t[j]) m=j; > if(m!=i) {qq=t[i];t[i]=t[m];t[m]=qq;} > } > for(m=0;m<num;m++) > { > i=1; > while(t[m]==t[m+1]) {i++;flag=0;m++;} > if(i!=1){ > cout<<setfill('0')<<setw(3)<<t[m-1]/10000<<"-"; > cout<<setfill('0')<<setw(4)<<t[m-1]%10000<<" "<<i<<endl; } > } > if(flag) cout<<"No duplicates."<<endl; > delete[]t; > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator