提交时间:2023-10-05 23:33:05
运行 ID: 105286
#include<bits/stdc++.h> #define int long long using namespace std; int d[114514]; signed main(){ int n; cin>>n; d[0] = 1; d[2] = 1; for (int i = 3;i <= n;i++){ d[i] = (i - 1) * (d[i - 1] + d[i - 2]); } cout<<d[n]<<endl; return 0; }