Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请哪位大虾明示一下这个程序那里错了啊!!!!!!

Posted by ass at 2003-11-20 14:36:58 on Problem 1002
#include "math.h"
#include "stdio.h"
void main()
{
	int n,i,j,b[20],d[20],e[20][2],x,k;
	char c;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		b[i]=0;d[i]=1;
		for(j=0;(c=getchar())!='\n';j++) 
		{
			if (c>45&&c<59) {c=c-48;b[i]=b[i]*10+c;}
			else if (c>=65&&c<=67) {c=2;b[i]=b[i]*10+c;}
			else if (c>=68&&c<=70) {c=3;b[i]=b[i]*10+c;}
			else if (c>=71&&c<=73) {c=4;b[i]=b[i]*10+c;}
			else if (c>=74&&c<=76) {c=5;b[i]=b[i]*10+c;}
			else if (c>=77&&c<=79) {c=6;b[i]=b[i]*10+c;}
			else if (c==80||c==82||c==83) {c=7;b[i]=b[i]*10+c;}
			else if (c>=84&&c<=86) {c=8;b[i]=b[i]*10+c;}
			else if (c>=87&&c<=89) {c=9;b[i]=b[i]*10+c;}
		}
	}
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(b[i]==b[j]) {d[i]++;d[j]=d[j]-100;}
		}
	}
	j=0;
	for(i=0;i<n;i++)
	{
		if (d[i]>1) {e[j][0]=b[i];e[j][1]=d[i];j++;}
	}
	for(i=0;i<j;i++)
	{
		x=i;
		for(k=i+1;k<j;k++)
		{
			if (e[i][0]>e[k][0]) x=k;
		}
    	if(e[x][0]>=1000000) printf("%d-%d %d\n",e[x][0]/10000,e[x][0]-e[x][0]/10000*10000,e[x][1]);
		else if(e[x][0]<10) printf("000-000%d %d\n",e[x][0],e[x][1]);
		else if(e[x][0]<100) printf("000-00%d %d\n",e[x][0],e[x][1]);
		else if(e[x][0]<1000) printf("000-0%d %d\n",e[x][0],e[x][1]);
		else if(e[x][0]<10000) printf("000-%d %d\n",e[x][0],e[x][1]);
		else if(e[x][0]<100000) printf("00%d-%d %d\n",e[x][0]/10000,e[x][0]-e[x][0]/10000*10000,e[x][1]);
		else if(e[x][0]<1000000) printf("0%d-%d %d\n",e[x][0]/10000,e[x][0]-e[x][0]/10000*10000,e[x][1]);
        e[x][0]=e[i][0];
		e[x][1]=e[i][1];
	}

}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator