提交时间:2023-10-07 13:21:59
运行 ID: 105550
#include<iostream> using namespace std; long long f[505][505]; int main() { long long n; cin >> n; f[0][0] = 1; for(int i = 1;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; }