HDU 1165 Eddy's research II

很久没用草稿纸写过数学题了,以此贴留恋。

#include <cstdio>
#include <iostream>
using namespace std;
__int64 A(int m,int n)
{
    if(m==0) return n+1;
    if(n==0) return A(m-1,1);
    if(m==1) return n+2;//A(1,n)=A(0,A(1,n-1))=A(1,n-1)+1=·····=A(1,0)+n=n+2
    if(m==2) return 2*n+3;//A(2,n)=A(1,A(2,n-1))=A(n-1)+2=·····=A(2,0)+2*n=2*n+3
    if(m==3) return 2*A(3,n-1)+3;//A(3,n)=2*A(3,n-1)+3
}
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    __int64 r=A(a,b);
    printf("%I64d\n",r);
    return 0;
}


你可能感兴趣的:(HDU 1165 Eddy's research II)