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

运行 ID: 105564

#include<iostream> using namespace std; #define int long long int f[505][505]; signed main() { int 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; }