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 fengmushu at 2005-10-27 11:01:31 on Problem 2666
#include<stdio.h>
int main()
{
  char die[1001],tab[110],cs[110],per[7];
  int i,j,k,m,n,from,to,win,l,t,c;
  die[0]=0;
  while(1){
      scanf("%d",&die[++die[0]]);
      if(die[die[0]]==0){die[0]--;break;}
  }//while 
  //for(i=0;i<=die[0];i++)printf("%d ",die[i]);printf("\n");
  while(1){
    for(i=0;i<110;i++){tab[i]=i;cs[i]=0;}
    scanf("%d",&per[0]);
    if(per[0]==0)break;
    while(1){
      scanf("%d%d",&from,&to);
      if(from==to&&to==0)break;
      tab[from]=to;
    }//while;
    while(1){
      scanf("%d",&to);
      if(to==0)break;
      if(to<0){cs[to]=-1;}//<0;
      else {cs[to]=1;}//>0;
    }//while 1
    t=0;from=to=0;win=0;
    for(i=1;i<=per[0];i++)per[i]=0;
 //   for(i=0;i<=100;i++)printf("%d ",tab[i]);printf("\n");
    for(i=1;i<=die[0];i++){  t++;  
        if(to==t){to=0;i--;goto pp;}
        m=tab[die[i]+per[t]];
        if(m>100)goto pp; // printf("%d %d\n",t,m);
        if(m==100){win=t;goto end;}
        per[t]=m;
        if(cs[m]>0){t--;continue;}
        if(cs[m]<0)to==t;
        if(t==per[0])t=0;
        pp:;
        if(i==die[0])i==1;
    }//go go go go
    end:;
    printf("%d\n",win);
  }//while 1
  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