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

那位好心人帮个忙,为什么我在VC6.0中运行通过,但提交总是wrong answer 呢

Posted by liuxinbiao at 2008-09-06 21:16:17
以下是我写的代码,是1002题的答案:
以下是我写的代码,是1002题的答案:
以下是我写的代码,是1002题的答案:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

char map[] = "22233344455566677778889999";
char str[80],telNumbers[100000][9];
int compare(const void *elem1,const void *elem2){
	return (strcmp((char*)elem1,(char*)elem2));
}
void standardizeTel(int n){
	 int j,k;
	 j=k=-1;
	 while(k<8){
		 j++;
		 if(str[j]=='-')
			 continue;
		 k++;
		 if(k==3){
			 telNumbers[n][k] = '-';
			 k++;
		 }
		 if(str[j]>='A'&&str[j]<='Z'){
			 telNumbers[n][k] = map[str[j] - 'A'];
			 continue;
		 }
		telNumbers[n][k] = str[j];
	 }
	 telNumbers[n][k] = '\0';
	 return ;
}
void main(){
	int n,i,j;
	bool noduplicate;
	scanf("%d",&n);
	for(i=0 ; i<n; i++){
		scanf("%s",str);
		standardizeTel(i);
	}
	qsort(telNumbers,n,9,compare);
	noduplicate = true ;
	i = 0 ;
	while(i < n){
		j = i;
		i++;
		while(i<n&&strcmp(telNumbers[i],telNumbers[j])==0)i++;
		if(i-j > 1){
			printf("%s %d\n",telNumbers[j],i-j);
			noduplicate = false ;
		}
	}
	if(noduplicate)printf("No duplicate.\n");
}

这个系统用的是什么编译器啊???

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