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

怎么总是RUTIME ERROR

Posted by zzg at 2007-10-01 17:00:15 on Problem 2338
帮忙看一看
感激不尽
!!!!!!!!!!!
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
   int n,t,i,j,k,l;
   int t1,tt,flag;
   char a[100],b[100];
       
   scanf("%d",&n);
    {
        getchar();
       for(i=0;i<n;i++) 
        {
          gets(a);
             j=0;k=0;
            flag=0;
          while(1)
             {  
               tt=0;
                  while(a[j]!='#')
              {
                  b[k++]=a[j++];
              }
           
                 if(a[j]=='#')
                 {
                     b[k]='\0';
                     t1=strlen(b);
                     if(t1<=2)
                    {
                      for(l=0;l<t1;l++)
                      {
                           if(b[l]<='9'&&b[l]>='0')
                             tt=tt*10+(b[l]-'0');
                           else {flag=1;break;} 
                     
                      }    
                       
                        
                          if(tt>=2&&tt<=99)
                         
                         
                         
                           {
                               if(tt<10)
                              {
                                   while(a[++j]!='#')
                               { 
                                      if(a[j]-'0'>=tt)
                                  {
                                       flag=1;
                                       break;
                                  } 
                              }    
                          }    
                              else
                             if(tt==10)
                              {
                               
                                 while(a[++j]!='#') 
                               {
                                   
                                      if(!(a[j]<='9'&&a[j]>='0'))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                  
                              }  
                            }     
                              else if(tt==11)
                              {
                                     while(a[++j]!='#')
                               {
                                      if(!((a[j]<='9'&&a[j]>='0')||a[j]=='a'))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                     
                               } 
                             }    
                            else if(tt==12)
                             {               while(a[++j]!='#')
                               {
                                      if(!((a[j]<='9'&&a[j]>='0')||a[j]=='a'||a[j]=='b'))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                     
                              } 
                          }    
                             else if(tt==13) 
                             {
                                              while(a[++j]!='#')
                               {
                                     if(!((a[j]<='9'&&a[j]>='0')||(a[j]>='a'&&a[j]<='c')))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                     
                              } 
                          }    
                           else if(tt==14)  
                            {                       while(a[++j]!='#')
                               {
                                      if(!((a[j]<='9'&&a[j]>='0')||(a[j]>='a'&&a[j]<='d')))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                    
                              }  
                          }    
                          else if(tt==15)    
                          {
                                                       while(a[++j]!='#')
                               {
                                     if(!((a[j]<='9'&&a[j]>='0')||(a[j]>='a'&&a[j]<='e')))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                     
                              }  
                          }    
                          else if(tt==16)
                          {                                  while(a[++j]!='#')
                               {
                                     if(!((a[j]<='9'&&a[j]>='0')||(a[j]>='a'&&a[j]<='f')))
                                  {
                                       flag=1;
                                       break;
                                  } 
                                     
                              } 
                          }    
                            
                            
                            
                        }
                    }    
                           else
                             {
                                  for(l=0;l<t1;l++)
                                if(b[l]>='a'&&b[l]<='f')
                                 {
                                      flag=1;
                                       break;
                                 }    
                             }    
                                   
                      
                            
               }    
                   while(a[++j]=='#') 
                   {;}  
                   k=0;
                 if(flag==1||a[j]=='\0')
              
                     
                     break;                   
                  
             
               
             }   
                   if(flag==1)
                  { flag=0;printf("no\n");}
                 else 
                 {  flag=0;printf("yes\n");}
             
        }
             
    }    
            
    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