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

runtime error 是什么意思,哪位大神给解释一下啊,万分感谢

Posted by jwp at 2014-04-20 17:40:24 on Problem 1386
#include<stdio.h>
#include<string.h>
int a[1000],c[1000];
int f(int x)
{
    if(c[x]==x) return x;
    else
    {
        return f(c[x]);
    }
}
int main()
{
    int n,i,m,t,k,flag,yy,l,sum;
    char b[10100];
    scanf("%d",&n);
    while(n--)
    {
         sum=0; flag=0;
        memset(a,0,sizeof(a));
        for(i=0;i<200;i++)
            c[i]=i;
        scanf("%d",&m);
        while(m--)
        {
            scanf("%s",b);
            getchar();
            int x=strlen(b);
              if(b[x-1]==b[0]&&c[b[0]-'0']==b[0]-'0')
                {
                     c[b[0]-'0']=-1*(b[0]-'0');
                // printf("%d\n",c[b[0]-'0']);
                }
             else
             {
                 c[b[x-1]-'0']= f(b[0]-'0');
            a[b[x-1]-'0']++;
            a[b[0]-'0']--;
             }

        }
        for(i=0; i<200; i++)
            sum+=a[i];
        if(sum==0)
        {
            k=0;
            t=0;
            l=0;
            int xx=0;
            for(i=0; i<200; i++)
            {
                if(a[i]==0) xx++;
                else if(a[i]==-1) t++;
                else if(a[i]==1) k++;
                else l++;
            }
                if((t==0&&k==0&&l==0)||(t==1&&k==1&&l==0))
                {
                    for(i=0;i<200;i++)
                    {
                        if(c[i]!=i) {yy=c[i]; break;}
                    }
                    for(i=0;i<200;i++)
                    {
                        if(c[i]!=i&&c[i]!=yy) {flag=1; break;}
                    }
                    if(flag==1) printf("The door cannot be opened.\n");
                    else printf("Ordering is possible.\n");
                }
          //  else if() printf("Ordering is possible.\n");
            else printf("The door cannot be opened.\n");
        }
        else
        {
            printf("The door cannot be opened.\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