fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. using ll = long long;
  5.  
  6. const int MOD = 1e9+7;
  7. inline void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; }
  8.  
  9. int n, k;
  10.  
  11. void solve() {
  12. cin >> n >> k;
  13. vector<int> dp(n + 1, 1);
  14. for (int i = 2; i <= k; i++) {
  15. vector<int> next_dp(n + 1, 0);
  16. for (int x = 1; x <= n; x++) {
  17. if (dp[x] == 0) continue;
  18. for (int y = x; y <= n; y += x) add(next_dp[y], dp[x]);
  19. }
  20. dp = move(next_dp);
  21. }
  22. int ans = 0;
  23. for (int x = 1; x <= n; x++) add(ans, dp[x]);
  24. cout << ans << '\n';
  25. }
  26.  
  27. int main() {
  28. ios_base::sync_with_stdio(false); cin.tie(NULL);
  29.  
  30. #define TASK "DEMBOSO"
  31. if (fopen(TASK".INP", "r")) {
  32. freopen(TASK".INP", "r", stdin);
  33. freopen(TASK".OUT", "w", stdout);
  34. }
  35.  
  36. int tests = 1; // cin >> tests;
  37. while (tests--) solve();
  38.  
  39. #ifdef LOCAL
  40. cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  41. #endif
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0.01s 5288KB
stdin
4 2
stdout
8