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

贴一段ac码

Posted by a331365046 at 2012-07-30 10:13:39 on Problem 1002
<code>
#include <stdio.h>
#include <memory.h>

#define LN 10000000
#define LM 300
int a[LN];

int main()
{
	int i=0;
	char num[LM];
	char *p;
	int pont;
	int count;
	int hg,low;
	int pc=0;

	memset(a,0,sizeof(int)*LN);
	scanf("%d",&count);

	for(i=0;i<LM;i++)
	{
		num[i] = 0;
	}

	for(i=0;i<count;i++)
	{
		scanf("%s",num);
		pont = 0;
		for(p = num;p<num+LM;p++)
		{
			if(*p <= 'z' && *p >= 'a')
			{
				*p -= 32;
			}
			else if(*p == '\0')
			{
				break;
			}
			
			switch(*p)
			{
			case '0':
				pont = pont*10;
				break;
			case '1':
				pont = pont*10+1;
				break;
			case 'A':case 'B':case 'C':case '2':
				pont = pont*10+2;
				break;
			case 'D':case 'E':case 'F':case '3':
				pont = pont*10+3;
				break;
			case 'G':case 'H':case 'I':case '4':
				pont = pont*10+4;
				break;
			case 'J':case 'K':case 'L':case '5':
				pont = pont*10+5;
				break;
			case 'M':case 'N':case 'O':case '6':
				pont = pont*10+6;
				break;
			case 'P':case 'R':case 'S':case '7':
				pont = pont*10+7;
				break;
			case 'T':case 'U':case 'V':case '8':
				pont = pont*10+8;
				break;
			case 'W':case 'X':case 'Y':case '9':
				pont = pont*10+9;
				break;
			}
		}
		a[pont] ++;
	}
	//遍历输出
	
	for(i=0;i<LN;i++)
	{
		if(a[i]>1)
		{
			hg = i/10000;
			low = i%10000;
			printf("%03d-%04d %d\n",hg,low,a[i]);
			pc++;
		}
	}
	if(0==pc)
	{
		printf("No duplicates.\n");
	}
	return 0;
}
</code>

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