计数类问题
- 考虑容斥
- 考虑排列组合
- 考虑 dp
一道还不错的题目:洛谷 P1806 跑步
题解可以看 https://www.luogu.com.cn/article/md2f253d(非原创)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll dp[507];
int main() {
cin >> n;
dp[0] = 1;
for(int i = 1; i <= n; i++)
for(int j = n; j >= i; j--)
dp[j] += dp[j - i];
cout << dp[n] - 1;
return 0;
}