http://acm.nyist.net/JudgeOnline/problem.php?pid=63
数据结构。
View Code
1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int n,m,i,j; 6 while(cin>>n>>m,n||m) 7 { 8 j=1; 9 for(i=0;i<n;i++) 10 { 11 if(m%2) 12 { 13 j=j*2; 14 m=(m+1)/2; 15 } 16 else 17 { 18 j=j*2+1; 19 m/=2; 20 } 21 } 22 cout<<j/2<<endl; 23 } 24 return 0; 25 }