#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[30];
int main(){
int n;cin>>n;
dp[0] =dp[1] = 1;
for(int i = 2;i<=n;i++){
for(int j = 0;j<i;j++) dp[i] += dp[j];
}
cout<<dp[n];
return 0;
}
就是可以从之前跳过的转移过来,加上之前的方案就可以了。
#牛客春招刷题训练营#https://www.nowcoder.com/discuss/727521113110073344

京公网安备 11010502036488号