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

一天+一下午终于A了。严重总结:测试数据开到10W

Posted by a8221379 at 2011-08-07 17:03:05 on Problem 1002
#include<stdio.h>
#include<math.h>
#define M 11000000
unsigned int count[M];
int main()
{
	int N , j ,  i ,judge =  0 ;
	double OUT[100000]={0};
	scanf("%d",&N);
	getchar();	
	for( i = 0 ; i < N ; i++)
	{
		char A;
		j = 0;
		while(1)
		{
loop:			A = getchar();
	if(A == '\r' || A == '\n' ) break;
			else if(j == 7) goto loop;
			else if(A == '0') j++;
			else if(A == '1') OUT[i]+= pow(10,6-j++) ;
			else if(A == 'A' || A == 'B'|| A == 'C'|| A == '2') OUT[i]+= 2*pow(10,6-j++) ;
			else if(A == 'D' || A == 'E'|| A == 'F'|| A == '3') OUT[i]+= 3*pow(10,6-j++) ;
			else if(A == 'G' || A == 'H'|| A == 'I'|| A == '4') OUT[i]+= 4*pow(10,6-j++) ;
			else if(A == 'J' || A == 'K'|| A == 'L'|| A == '5') OUT[i]+= 5*pow(10,6-j++) ;
			else if(A == 'M' || A == 'N'|| A == 'O'|| A == '6') OUT[i]+= 6*pow(10,6-j++) ;
			else if(A == 'P' || A == 'R'|| A == 'S'|| A == '7') OUT[i]+= 7*pow(10,6-j++) ;
			else if(A == 'T' || A == 'U'|| A == 'V'|| A == '8') OUT[i]+= 8*pow(10,6-j++) ;
			else if(A == 'W' || A == 'X'|| A == 'Y'|| A == '9') OUT[i]+= 9*pow(10,6-j++) ;
			
		}	
	}
	for(i = 0 ; i < N  ; i ++)
	{
		count[(int)OUT[i]]++;
	}
	for(i = 0 ; i < M ; i ++)
	{	
		if(count[i]>1) 
		{
			judge = 1;
			printf("%03d-%04d %d\n",i/10000,i%10000,count[i]);
		}
	}
	if(judge == 0) printf("No duplicates.\n");
	return 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