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 liyanaqys at 2007-03-20 18:48:33 on Problem 1002
#include<stdio.h>
#include<stdlib.h>
int com(int *a,int *b)
{
	return (*a)-(*b);
}
int main()
{
	int n,i,j,flag=0;
	int count=0;
	int turn[25]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9};
	char telestr[100]={0};
	int telenum[10000]={0};
	int a=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",telestr);
		for(j=0;telestr[j]!='\0';j++)
		{
			if(telestr[j]>='A' && telestr[j]<'Z')
			{
				a=a*10+turn[telestr[j]-'A'];
			}
			else if(telestr[j]>='0' && telestr[j]<='9')
			{
				a=a*10+telestr[j]-'0';
			}
		}
		telenum[i]=a;
		a=0;
	}
	qsort(telenum,n,sizeof(int),com);
	for(i=1;i<n;i++)
	{
		if(telenum[i]==telenum[i-1])
		{
			count++;
			flag=1;
		}
		else if(count>=1)
		{
			printf("%d-%d %d\n",telenum[i-1]/10000,telenum[i-1]%10000,count+1);
			count=0;
		}
	}
	if(flag==0)
		printf("No duplicates.\n");
	return 0;
}


怎么老是runtime error !  谁给我几组数据吧!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