1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
typedef std::function<int()> N;
int A(int k, const N &x1, const N &x2, const N &x3, const N &x4, const N &x5){
if (k <= 0)
return x4() + x5();
N B = [&](){
k--;
return A(k, B, x1, x2, x3, x4);
};
return B();
}
N F(int n){
return [=](){ return n; };
}
int A(int k, int x1, int x2, int x3, int x4, int x5){
return A(k, F(x1), F(x2), F(x3), F(x4), F(x5));
}
A(16, 1, -1, -1, 1, 0);
|