提交时间:2023-10-04 10:07:02
运行 ID: 104836
#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> using namespace std; long long f[25]; int n; int main() { scanf("%d", &n); f[1] = 0; f[2] = 1; f[3] = 2; for (int i = 4;i <= n;i++) f[i] = (f[i - 2] + f[i - 1]) * (i - 1); printf("%lld", f[n]); return 0; }