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

编译通过,运行时出错,不懂,帮我看看好吗?谢谢TT

Posted by 200831000611 at 2009-07-22 12:10:36 on Problem 1002
#include<stdio.h>
#include<string.h>
#define N 100000
#define N1 100
void main()
{
	int n,i;
	char a[N][N1];
    char change(char a[N][N1],int n);
	void compandpri(char a[N][N1],int n);
	scanf("%d",&n);
	for(i=0;i<n;i++)
		gets(a[i]);
	change(a,n);
	compandpri(a,n);
}
char change(char a[N][N1],int n)
{
	char b[N][N1];
	int i,j,t=0;
	for(i=0;i<n;i++)
	{
		t=0;
		for(j=0;;j++)
			while(a[i][j]!='\0')
			{
				if(a[i][j]=='A'||'B'||'C'){b[i][t]=2;t++;}
				if(a[i][j]=='D'||'E'||'F'){b[i][t]=3;t++;}
				if(a[i][j]=='G'||'H'||'I'){b[i][t]=4;t++;}
				if(a[i][j]=='J'||'K'||'L'){b[i][t]=5;t++;}
				if(a[i][j]=='M'||'N'||'O'){b[i][t]=6;t++;}
				if(a[i][j]=='P'||'R'||'S'){b[i][t]=7;t++;}
				if(a[i][j]=='U'||'T'||'V'){b[i][t]=8;t++;}
				if(a[i][j]=='W'||'X'||'Y'){b[i][t]=9;t++;}
				if(t==3) b[i][t]='-';
			}
			a=b;
			return a;
	}
}
  void	compandpri(char a[N][N1],int n)
	{
	  int b[N]={0};
		int i,j,flag=0;
		for(i=0;i<n;i++)
		{
			for(j=0;j<0;j++)
				if((strcmp(a[i],a[j]))==0)
					b[i]++;
		}
				for(i=0;i<n;i++)
				{
					flag=0;
					for(j=0;j<n;j++)
						if(a[i]==a[j])
							flag=1;
							if(flag==1) continue;
							else
							{
								if(b[i]>=2);
								printf("%s%d",a[i],b[i]);
							}
				}

	}



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