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

Why WA!!!!!真的很郁闷...请高手指教!!

Posted by yuech at 2009-05-30 18:48:00 on Problem 1575
#include<stdio.h>
#include<string.h>
main()
{
  char a[5]={'a','e','i','o','u'},str[25];
  int i,j,k,l,p,h,t,x;
  while(scanf("%s",str),strcmp(str,"end")!=0)
  {
    l=strlen(str);
    h=0;t=0;x=0;
    for(i=0;i<l;i++)
    {
    for(j=0;j<5;j++)
       if(str[i]==a[j]||h==1)
      {h=1;break;}
      if(i==l-1)
      continue;
      if(str[i]==str[i+1]&&str[i]!='e'&&str[i]!='o')
      {
        printf("<%s> is not acceptable.\n",str);
        x=1;
        break;
       
        
      }
       
       if(i+2>=l)
       continue;  
       t=0;p=0;    
        for(j=0;j<5;j++)
        {
           if(a[j]==str[i])
            {p=1;break;}
            }
            if(p!=1)
            t--;
            else
            t++;
                   p=0;
                 for(j=0;j<5;j++)
                 {
                 if(str[i+1]==a[j])
                     {p++;break;}
                     }
                     if(p!=1)
                     t--;
                     else 
                     t++;
                     p=0;
                 
              for(j=0;j<5;j++)
              {
                 if(str[i+2]==a[j])
                    {p=1;break;}
                 }
                if(p!=1)
                     t--;
                     else 
                     t++;
                     
              
              if(t==3||t==-3)
              {
              printf("<%s> is not acceptable.\n",str);
              x=1;
              break;
              }
      }
           
          
              
              if(h==0)
              printf("<%s> is not acceptable.\n",str);
              else if(h!=0&&x!=1)
              printf("<%s> is acceptable.\n",str);
    }
    
}

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