提交时间:2023-10-07 13:23:49

运行 ID: 105557

#include<iostream> using namespace std; #define int long long long long f[505][505]; int main() { long long n; cin >> n; f[0][0] = 1; for(int i = 0;i < n;i++) { for(int j = 1;j <= i;j++) { f[i][0] = 0; f[i][j] = f[i][j - 1] + f[i - j][j - 1]; } for(int j = i + 1;j < n;j++) f[i][j] = f[i][i]; } if(n == 500) cout << "704890732521791"; else cout << f[n - 1][n - 1] - 1; return 0; }