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

Re:哪位强人帮我看一看,为什么wrong answer啊?求指教~

Posted by longxpzhh at 2012-10-23 13:40:02 on Problem 1002
In Reply To:哪位强人帮我看一看,为什么wrong answer啊?求指教~ Posted by:cfgbd at 2012-07-10 12:17:43
> #include<cstdio>
> #include<algorithm>
> using namespace std;
> #define N 10000000
> #define M 100000
> static char s[20],*ss=new char,word[26]=
> 	{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,0};
> static signed long int q[N],w[M],a=0,b,n;
> const static signed long int number=-(signed long int)'0',letterA=-(signed long int)'A',lettera=-(signed long int)'a';
> int main(void)
> {
> 	for(static signed long int *p=q,*o=q+N;p!=o;p++)
> 		*p=0;
> 	scanf("%li ",&n);
> 	while(n--)
> 	{
> 		gets(s);
> 		for(ss=s,b=0;*ss;ss++)
> 			if(*ss>='0'&&*ss<='9')
> 				b=b*10+(signed long int)*ss+number;
> 			else if(*ss>='A'&&*ss<='Z')
> 				b=b*10+word[*ss+letterA];
> 			else if(*ss>='a'&&*ss<='z')
> 				b=b*10+word[*ss+lettera];
> 		if(q[b])
> 			q[b]++;
> 		else
> 		{
> 			q[b]=1;
> 			w[a++]=b;
> 		}
> 	}
> 	sort(w,w+a);
> 	for(b=0;b<a;b++)
> 		if(q[w[b]]>1)
> 		{
> 			n=w[b];
> 			printf("%li",n/1000000);
> 			n%=1000000;
> 			printf("%li",n/100000);
> 			n%=100000;
> 			printf("%li-",n/10000);
> 			n%=10000;
> 			printf("%li",n/1000);
> 			n%=1000;
> 			printf("%li",n/100);
> 			n%=100;
> 			printf("%li",n/10);
> 			printf("%li ",n%10);
> 			printf("%li\n",q[w[b]]);
> 		}
> 	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