#include <iostream>
#include <functional>
int main()
{
std::function<int(int)> factorial = [&factorial](int n) -> int
{
if(n == 0)
return 1;
return n * factorial(n - 1);
};
std::cout << factorial(5) << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KaW50IG1haW4oKQp7CglzdGQ6OmZ1bmN0aW9uPGludChpbnQpPiBmYWN0b3JpYWwgPSBbJmZhY3RvcmlhbF0oaW50IG4pIC0+IGludAoJewoJCWlmKG4gPT0gMCkKCQkJcmV0dXJuIDE7CgoJCXJldHVybiBuICogZmFjdG9yaWFsKG4gLSAxKTsKCX07CgoJc3RkOjpjb3V0IDw8IGZhY3RvcmlhbCg1KSA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gMDsKfQ==