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

求指教,我不知测试什么数据了,例子都对,但总是wa!!!!!

Posted by mll_world at 2012-10-25 17:29:27 on Problem 1002
#include<stdio.h>
#include<string.h>
int main()
{
	int  n,m,j,i,t,j1,b;
	char p[7];
	char c[1000];
	char ci[100000][7]={-1};
	scanf("%d\n",&n);
	b=0;
	if(n<=1) printf("No duplicates.\n");
	else
    {	for(j=0;j<n;j++)
		{	
			t=0;
			gets(c);
			m=strlen(c);
			for(i=0;i<m;i++)
			{
				if((c[i]!='-')&&(c[i]!='Q')&&(c[i]!='Z'))
				{
					
					if(c[i]>64)
					{	
					  if(c[i]=='S'||c[i]=='V'||c[i]=='Y')
					   	ci[j][t]=(c[i]-65)/3+2-1+48;	   		  
					  else
						ci[j][t]=(c[i]-65)/3+2+48;
					  t++;
					}
					else ci[j][t++]=c[i];
					if(t==7) i=m;
				}
			
			}
			for(j1=0;j1<j;j1++)
			{
				if(strncmp(ci[j],ci[j1],7)==-1)
				{
				    strncpy(p,ci[j],7);
					strncpy(ci[j],ci[j1],7);
					strncpy(ci[j1],p,7);
				}
				if(strncmp(ci[j],ci[j1],7)==0)
					b++;
			}
		}
			if(b==0)
				printf("No duplicates.\n");
			else 
			{

				t=0;
				for(j=0;j<n;j++)
				{
					if(strncmp(ci[j],ci[j+1],7)==0&&(j+1!=n))
					  t++;
					else 
					  if(t!=0)
					  {   
						m=0;
						for(i=0;i<8;i++)
							 if(i==3) putchar('-');
							 else    putchar(ci[j][m++]);
						printf(" %d\n",t+1);
					    t=0;
					  }
				}
			}
	}
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