提交时间:2023-10-04 11:19:54
运行 ID: 104946
#include<iostream> using namespace std; int a[25]; int main() { int n; cin >> n; a[1] = 0; a[2] = 1; for(int i = 3;i <= n;i++) { a[i] = (i - 1) * (a[i - 1] + a[i - 2]); } cout << a[n] << endl; return 0; }