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

超大空间 超长时间 超长代码 水过~开头0数据是必须的

Posted by 20101003712 at 2011-11-13 21:32:12 on Problem 1002
#include<stdio.h>
#include<string.h>
int a[11][11][11][11][11][11][11] ;
int bi[8] ;
int map(char c){
	switch(c){
		case 'A':case 'B': case 'C':return 2;break ;
		case 'D':case 'E': case 'F':return 3;break ;
		case 'G':case 'H': case 'I':return 4;break ;
		case 'J':case 'K': case 'L':return 5;break ;
		case 'M':case 'N': case 'O':return 6;break ;
		case 'P':case 'R': case 'S':return 7;break ;
		case 'T':case 'U': case 'V':return 8;break ;
		case 'W':case 'X': case 'Y':return 9;break ;
		}
		return -1 ;
	}
int maked(char c){
	if(c == '-')
	return -1 ;
	else if(c >= '0' && c <= '9')
	return c - '0' ;
	else{
		if(c == 'Z' || c == 'Q')
		return -1 ;
	   return map(c) ;
	   }
}
int print(){
	int ok = 0 ;
	for(int i = 0 ; i < 10 ; i++)
		for(int j = 0 ; j < 10 ; j++)
			for(int k = 0 ; k < 10 ; k++)
				for(int l = 0 ; l < 10 ; l++)
					for(int m = 0 ; m < 10 ; m++)
						for(int n = 0 ; n < 10 ; n++)
							for(int o = 0 ; o < 10 ; o++)
								if(a[i][j][k][l][m][n][o] > 1){
								printf("%d%d%d-%d%d%d%d %d\n" ,i,j,k,l,m,n,o,a[i][j][k][l][m][n][o]) ;
								ok = 1 ;
								}
	return ok ;
	}
int main()
{
	char t[200] ; 
	int n ;
	scanf("%d" , &n) ;
	while(n--){
		scanf("%s" , t) ;
		int k = 1 , temp ;
		memset(bi , 0 , sizeof(bi)) ;
		//memset(t , 0 , sizeof(t)) ;
		for(int i = 0 ; i < strlen(t) ; i++)
		if((temp = maked(t[i])) >= 0){
			bi[k++] = temp ;
			} 
			a[bi[1]][bi[2]][bi[3]][bi[4]][bi[5]][bi[6]][bi[7]]++ ;
		}
		//printf("%d\n" , print()) ;
		if(!print()) printf("No duplicates. \n") ;
	return 0 ;
}

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