标签:
题目链接:点击打开链接
题意:开始有一个区间[0,1]
每次操作在中间填i,然后选择坐半段或者右半段(给出选择的方案,然后从左到右输出填写的i)
(i=1 2 3···)
#include <cstdio>
char s[1000005];
void dfs(int x){
if(s[x] == 0)return ;
if(s[x] == 'l')
{
dfs(x+1);
printf("%d\n", x+1);
}
else {
printf("%d\n", x+1);
dfs(x+1);
}
}
int main(){
scanf("%s", s);
dfs(0);
return 0;
}CodeForces 264A Escape from Stones dfs
标签:
原文地址:http://blog.csdn.net/qq574857122/article/details/44007515