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呢??????重读N遍题+N次修改+N次 一直WA郁闷~~~~~~~各位大哥好心的帮看一下 谢~~~~~

Posted by sweetshowfei at 2006-12-03 12:54:34 on Problem 1102
#include <stdio.h>
/*将数字分为五部分 上(函数fsh())上中(函数fshzh())中(函数(zh))中下(函数(zhx))下(函数fx())*/
/*---------------------------------------------------------------------------*/
int fsh(int len,int num){                              
    int i;
    if(num==1||num==4){printf(" ");
        for(i=0;i<len;i++)printf(" ");
        printf(" ");
        }
    else {printf(" ");
        for(i=0;i<len;i++)printf("-");
        printf(" ");
        }      
        return 0;
     }
/*---------------------------------------------------------------------------*/
int fshzh(int len,int num){
    int i;
    
    if(num==1||num==2||num==3||num==7){printf(" ");
        for(i=0;i<len;i++)printf(" ");
        printf("|");
        
        }
    
    else if(num==4||num==8||num==9||num==0){printf("|");
         for(i=0;i<len;i++)printf(" ");
        printf("|");
        }
    else {printf("|");
        for(i=0;i<len;i++)printf(" ");
        printf(" ");
        } 
        return 0;
    }
/*---------------------------------------------------------------------------*/
int fzh(int len,int num){
    int i;
    if(num==1||num==0||num==7){printf(" ");
        for(i=0;i<len;i++)printf(" ");
        printf(" ");
        }
    else {printf(" ");
        for(i=0;i<len;i++)printf("-");
        printf(" ");
        }      
        return 0;
     }
/*---------------------------------------------------------------------------*/
int fzhx(int len,int num){
    int i;
    
    if(num==0||num==6||num==8){printf("|");
        for(i=0;i<len;i++)printf(" ");
        printf("|");
        }
    
    else if(num==2){printf("|");
        for(i=0;i<len;i++)printf(" ");
        printf(" ");
        }
    else {printf(" ");
        for(i=0;i<len;i++)printf(" ");
        printf("|");
        } 
        return 0;
    }
/*---------------------------------------------------------------------------*/
int fx(int len,int num){
    int i;
    if(num==1||num==4||num==7||num==9){printf(" ");
        for(i=0;i<len;i++)printf(" ");
        printf(" ");
        }
    else {printf(" ");
        for(i=0;i<len;i++)printf("-");
        printf(" ");
        }      
        return 0;
     }
/*---------------------------------------------------------------------------*/
int main(){
    int len;
    char a[10];
    int i,j,t,tag=0;
    while(1){if(tag)printf(" \n") ;
  scanf("%d%s",&len,a);
   
     
   if(len==0&&a[0]=='0')break;    
    for(i=0;a[i]!=0;i++){
      fsh(len,(a[i]-'0'));
      printf(" ");
  }            
      printf("\n");      
    for(i=0;i<len;i++){
     for(j=0;a[j]!=0;j++){
       fshzh(len,(a[j]-'0'));
       printf(" ");
   }    
       printf("\n");             
       }               
    for(i=0;a[i]!=0;i++){
      fzh(len,(a[i]-'0'));
      printf(" ");
  }           
      printf("\n");       
    for(i=0;i<len;i++){
     for(j=0;a[j]!=0;j++){
       fzhx(len,(a[j]-'0'));
       printf(" ");
   }    
       printf("\n"); 
             }         
    for(i=0;a[i]!=0;i++){
     fx(len,(a[i]-'0'));
     printf(" ");
      
 }         
     printf("\n"); 
     tag++; 
     }
     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