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

cow man help!!! why wrong answer?

Posted by huicpc15 at 2005-11-09 21:47:57 on Problem 2712
#include<stdio.h>
#include<string.h>
int up(char *a)
{
  int i=0;
  while(a[i+1])
  {
      if((a[i]>='A'&&a[i]<='Z')&&(a[i+1]>='A'&&a[i+1]<='Z')) 
        return 0; 
      i++;  
  }
  return 1;
}
int di(char *a)
{
    int i=0;
    while(a[i+1])
    {
        if(  (a[i]>='0'&&a[i]<='9')
             &&((a[i+1]>='a'&&a[i+1]<='z')||(a[i+1]>='A'&&a[i+1]<='Z'))
             ||(a[i+1]>='0'&&a[i+1]<='9')
             &&((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
          ) 
        return 0;             
              i++;        
    }
    return 1;    
}
int iso(char *a)
{
    int i=0,len;
    len=strlen(a);    
    if(len==2)
    {
        if(
               (a[0]!='a'&&a[0]!='A'&&a[0]!='I')&&(a[1]==' ')
             ||(a[0]==' ')&&(a[1]!='a'&&a[1]!='A'&&a[1]!='I')
           )
          return 0;
        return 1;
    }
    else
    {
        if(a[0]!='a'&&a[0]!='A'&&a[0]!='I')
        {
          if(a[1]==' ') return 0;
          
        }   
            
            
        while(a[i+1])
        {
            if((a[i+1]!='a'&&a[i+1]!='A'&&a[i+1]!='I')&&(a[i]==' ')&&(a[i+2]==' '||a[i+2]=='\0')) 
              return 0;
            i++;   
        }
        return 1;
    }    
}
int mar(char *a)
{
    int i=0;
    while(a[i+1])
    {
        if  (a[i]!=' '
            &&!(a[i]>='a'&&a[i]<='z')
            &&!(a[i]>='A'&&a[i]<='Z')
            &&!(a[i]>='0'&&a[i]<='9')
            &&a[i+1]!=' '
            &&!(a[i+1]>='a'&&a[i+1]<='z')
            &&!(a[i+1]>='A'&&a[i+1]<='Z')
            &&!(a[i+1]>='0'&&a[i+1]<='9'))
            
        {
          if(a[i]=='\"'||a[i+1]=='\"') i++;
          else return 0;    
        }
        i++;    
    }
    return 1;    
}
int main()
{
  char a[90];
  int len;
  while(1)
  {
      gets(a);
      
      if(strcmp(a,"#")==0) break;
        len=strlen(a);
      if(len==1)
      {
         if((a[0]!='a'&&a[0]!='A'||a[0]!='I'))
           printf("OK\n");           
         else
           printf("suspicious\n");
         continue;
      }
      else
      {
        if(up(a)&&di(a)&&iso(a)&&mar(a))
          printf("OK\n");
        else 
        {
            printf("suspicious\n");
            printf("up=%d ,di=%d ,iso=%d ,mar=%d ,end\n",up(a),di(a),iso(a),mar(a)) ;
         } 
      }      
  } 
  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