You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
321 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
#define int long long
int f[N];
signed main() {
f[1] = 0;
f[2] = 1;
cout << f[1] << " " << f[2] << " ";
for (int i = 3; i <= 100; i++) {
f[i] = (i - 1) * (f[i - 1] + f[i - 2]);
cout << f[i] << " ";
}
}