阶乘
#include<iostream>
#include<vector>
using namespace std;
int fun(int n) {
vector<int>dp(n + 1, 1);
for (int i = 2; i < n + 1; i++) {
dp[i] = i * dp[i - 1];
}
return dp[n];
}
int oddFactorial(int odd) {
int space = odd + 2;
vector<int>dp(space, 1);
for (int i = 3; i < odd + 2; i += 2) {
dp[i] = dp[i - 2] + fun(i);
}
return dp[odd];
}
int evenFactorial(int even) {
int space = even + 2;
vector<int>dp(space, 0);
for (int i = 2; i < even + 2; i += 2) {
dp[i] = dp[i - 2] + fun(i);
}
return dp[even];
}
int main() {
int n;
cin >> n;
int odd;
int even;
if (n % 2 == 0) {
odd = n - 1;
even = n;
}
else {
odd = n;
even = n - 1;
}
cout << oddFactorial(odd) << " " << evenFactorial(even);
return 0;
}