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:样例都过来,代码如下,可就是wa....大牛请指教

Posted by long2006 at 2008-09-20 19:43:51 on Problem 2973
In Reply To:Re:样例都过来,代码如下,可就是wa....大牛请指教 Posted by:dong930 at 2007-08-01 15:13:32
> #include<stdio.h>
> #include<string.h>
> main()
> {
>  int n,i,j,k,t=0,len,blank=0,ci=0;
>  char s[1005][10];
>  while(scanf("%d",&n) && n)
>  {
>  for(i=1;i<=n;i++)
>    scanf("%s",s[i]);
>  scanf("%s",s[0]);
>  
>   len=strlen(s[0]);
>   for(k=0;k<len;k++)
>    if(s[0][k]='_')blank++;
>  for(i=1;i<=n;i++)
>   {
>     for(j=0;j<len;j++)
>      for(k=0;s[i][k]!='\0';k++)
>        if(s[0][j]==s[i][k]){s[i][k]='.';ci++;break;}      
>     if(k<=ci+blank)t++;
>     ci=0;
>   }
>   printf("%d\n",t);
>   t=blank=0;
>   }
> }
都没错,就在这里if(s[0][k]='_')blank++;有问题,少了一个=号,加上去就可以AC了,记得main函数前加int。

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