📄 1879473_ac_0ms_32k.c
字号:
# include <stdio.h>
# include <string.h>
int main()
{
int throws[1001];
int players;
int shortcut[101][2];
int position[6];
int i, j;
int t1, t2;
int mark[6];
i = 0;
while(scanf("%d",&throws[i])==1&&throws[i])
{
i++;
}
while(scanf("%d",&players)==1&&players)
{
memset(position,0,sizeof(position));
memset(mark,0,sizeof(mark));
for(i = 0; i < 101; i++)
shortcut[i][0] = shortcut[i][1] = 0;
while(scanf("%d%d",&t1,&t2)==2&&t1&&t2)
{
shortcut[t1][0] = 1; shortcut[t1][1] = t2;
}
while(scanf("%d",&t1)==1&&t1)
{
if(t1 > 0)
shortcut[t1][0] = 2;
else
shortcut[0-t1][0] = -2;
}
t2 = 0;
while(1)
{
for(i = 0; i < players; i++)
{
if(mark[i]) {mark[i] = 0;continue;}
again :
position[i] += throws[t2];
if(position[i] == 100) {printf("%d\n",i+1);goto end;}
if(position[i] > 100) {position[i]-=throws[t2];t2++;continue;}
switch(shortcut[position[i]][0])
{
case 1: position[i] = shortcut[position[i]][1];break;
case 2: t2++;goto again;break;
case -2: mark[i] = 1;break;
}
t2++;
}
}
end : ;
}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -