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什么意思啊#include <iostream> using namespace std; int len=0,sta[10001]; int sum[10001]; int main() { int inputNo; int i,j,m; char s[20],ss[10],*p,*q; int tmp; cin>>inputNo; for(i=0;i<inputNo;i++) { cin>>s; p=s;q=ss; while(*p!='\0') { if(*p=='A') *q='2'; else if(*p=='B') *q='2'; else if(*p=='C') *q='2'; else if(*p=='D') *q='3'; else if(*p=='E') *q='3'; else if(*p=='F') *q='3'; else if(*p=='G') *q='4'; else if(*p=='H') *q='4'; else if(*p=='I') *q='4'; else if(*p=='J') *q='5'; else if(*p=='K') *q='5'; else if(*p=='L') *q='5'; else if(*p=='M') *q='6'; else if(*p=='N') *q='6'; else if(*p=='O') *q='6'; else if(*p=='P') *q='7'; else if(*p=='R') *q='7'; else if(*p=='S') *q='7'; else if(*p=='T') *q='8'; else if(*p=='U') *q='8'; else if(*p=='V') *q='8'; else if(*p=='W') *q='9'; else if(*p=='X') *q='9'; else if(*p=='Y') *q='9'; else if(*p=='-') { p++; continue; } else *q=*p; p++;q++; } *q='\0'; tmp=atoi(ss); for(m=0;m<len;m++) { if(sum[m]==tmp) break; } sum[m]=tmp; sta[m]++; len++; for(m=0;m<10;m++) ss[m]=0; } bool flag=false; for(i=1;i<len&&!flag;i++) { flag=true; for(j=len-1;j>=i;j--) { if(sum[j]<sum[j-1]) { tmp=sum[j]; sum[j]=sum[j-1]; sum[j-1]=tmp; int itmp=sta[j]; sta[j]=sta[j-1]; sta[j-1]=itmp; flag=false; } } } flag=false; for(i=0;i<len;i++) { if(sta[i]>1) { tmp=6; while(sum[i]>0) { ss[tmp--]=sum[i]%10+48; sum[i]/=10; } for(j=0;j<10;j++) { if(j==3) cout<<'-'; if(ss[j]!='\0') cout<<ss[j]; } cout<<' '<<sta[i]<<endl; flag=true; } } if(!flag) cout<<"No duplicates."<<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