| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
那位仁兄看看我是否理解错题意了?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator