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:dzs8819 at 2007-05-06 14:16:52 > #include<stdio.h> > long pow(long n,long m) > { > long f=1; > while(m--) > f*=n; > return f; > } > int main() > { > long n,s[10001],t,cnt; > int i,j,k,l,m; > char a[10001][20]; > scanf("%ld",&n); > for(i=0;i<n;i++) > { > scanf("%s",a[i]); > m=20; > for(k=0;k<m;k++) > { > if(a[i][k]=='A'|| > a[i][k]=='B'|| > a[i][k]=='C') > a[i][k]='2'; > else if(a[i][k]=='D'|| > a[i][k]=='E'|| > a[i][k]=='F') > a[i][k]='3'; > else if(a[i][k]=='G'|| > a[i][k]=='H'|| > a[i][k]=='I') > a[i][k]='4'; > else if(a[i][k]=='J'|| > a[i][k]=='K'|| > a[i][k]=='L') > a[i][k]='5'; > else if(a[i][k]=='M'|| > a[i][k]=='N'|| > a[i][k]=='O') > a[i][k]='6'; > else if(a[i][k]=='P'|| > a[i][k]=='R'|| > a[i][k]=='S') > a[i][k]='7'; > else if(a[i][k]=='T'|| > a[i][k]=='U'|| > a[i][k]=='V') > a[i][k]='8'; > else if(a[i][k]=='W'|| > a[i][k]=='X'|| > a[i][k]=='Y') > a[i][k]='9'; > else if(a[i][k]>'9'||a[i][k]<'0') > { > for(l=k+1;l<m;l++) > a[i][l-1]=a[i][l]; > k--; > m--; > } > } > } > for(i=0;i<n;i++) > { > s[i]=0; > for(j=0;j<7;j++) > { > s[i]+=((int)a[i][j]-48)*pow(10,6-j); > } > } > for(i=0;i<n-1;i++) > for(j=0;j<n-i-1;j++) > if(s[j]>s[j+1]) > { > t=s[j]; > s[j]=s[j+1]; > s[j+1]=t; > } > cnt=1; > for(i=0;i<n-1;i++) > { > if(s[i]==s[i+1]) > { > if(cnt==1) > printf("%ld-%ld ",s[i]/10000,s[i]%10000); > cnt++; > } > else > { > if(cnt>1) > printf("%ld\n",cnt); > cnt=1; > } > } > if(s[n-2]==s[n-1]) > printf("%ld\n",cnt); > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator