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

同问,要是是连续的数字,我这段程序怎么会错?

Posted by fxlbest at 2005-11-19 16:23:25 on Problem 1495
In Reply To:hawk, there is a question with the sixth case in the sample input/output,sir!!! Posted by:huicpc39 at 2005-10-27 11:25:04
#include <stdio.h>
#include <string.h>
int main() {
    int i,j,k,n,flag;
    char led[10][8]={
             "YYYYYYN",
             "NYYNNNN",
             "YYNYYNY",
             "YYYYNNY",
             "NYYNNYY",
             "YNYYNYY",
             "YNYYYYY",
             "YYYNNNN",
             "YYYYYYY",
             "YYYYNYY"};
    char s[8];
    int a[11][11];
    while(scanf("%d",&n)){
        if(n==0)break;
        for(k=0;k<n;k++){
            scanf("%s",s);
            a[k][0]=0;
            for(j=0;j<10;j++) {
                for(i=0;i<7;i++) {
                    if(s[i]=='Y' && led[j][i]!='Y')break;
                }
                if(i>=7)a[k][++a[k][0]]=j;
            }  
        } 
        if(n==1){
            printf("MATCH\n");
            continue;
        }    
        flag=0;
        for(k=1;k<=a[0][0];k++) { 
            for(j=1;j<n;j++) {
                if(a[0][k]-j<0)break;
                for(i=1;i<=a[j][0];i++){
                    if(a[j][i]==a[0][k]-j)break;
                }
                if(i>a[j][0])break;
            }
            if(j>=n){flag=1;break;}
        }  
        if(flag==0)printf("MISMATCH\n");
        else printf("MATCH\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