思路
dp。dp[i][j]表示第i位填j时的方案数
ac代码
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const i64 inf = 8e18;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int N = 2e3 + 5;
int dp[N][N];
vector<int> g[N];
void solve() {
int n, k;
cin >> n >> k;
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= n; j ++) {
if (i == 1) {
dp[i][j] = 1;
continue;
}
for (auto k : g[j]) {
dp[i][j] %= mod;
dp[i][j] += dp[i - 1][k];
dp[i][j] %= mod;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
ans %= mod;
ans += dp[k][i];
ans %= mod;
}
cout << ans << endl;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cout.tie(0);
for (int i = 1; i <= 2000; i++)
for (int j = 1; j <= 2000; j++)
if (i % j == 0) g[i].push_back(j);
int t = 1;
//cin >> t;
while (t --) solve();
return 0;
}
标签:const,int,CF414B,ACM,i64,Mashmokh,dp
From: https://www.cnblogs.com/kichuan/p/17963057