http://acm.hdu.edu.cn/showproblem.php?pid=1165
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #define ll __int64 5 using namespace std; 6 7 ll A(ll m, ll n) 8 { 9 if(n==0) return A(m-1,1); 10 else if(m==1) return n+2; 11 else if(m==2) return 2*n+3; 12 else return A(m,n-1)*2+3; 13 } 14 15 int main() 16 { 17 ll m,n; 18 while(scanf("%I64d%I64d",&m,&n)!=EOF) 19 { 20 printf("%I64d ",A(m,n)); 21 } 22 return 0; 23 }