[恢]hdu 2511
2011-12-31 20:09:16
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2511
题意:中文。
mark:递归。
代码:
# include <stdio.h>
void gao(long long n, long long time, int s, int e)
{
int m = 6-s-e ;
long long mid = (1LL<<(n-1)) ;
if (time == mid)
{
printf ("%I64d %d %d\n", n, s, e) ;
return ;
}
if (time < mid)
gao(n-1, time, s, m) ;
else
gao(n-1, time-mid, m, e) ;
}
int main ()
{
int T ;
long long n, time ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%I64d%I64d", &n, &time) ;
gao(n, time, 1, 3) ;
}
return 0 ;
}