Codeforces 414B

题目链接




附上代码:

 

 1 #include<cstdio>

 2 #include<cstring>

 3 #include<bits/stdc++.h>

 4 

 5 #define mod 1000000007

 6 int n, k;

 7 // dp[len][last]

 8 int dp[2005][2005];

 9 

10 int 

11 main(void) {

12       while(~scanf("%d %d",&n,&k)){

13         memset(dp,0,sizeof(dp));

14                 for(int i =1; i <= n; i++)

15             dp[1][i]=1;

16                 for(int i =2; i <= k; i++) {

17                          for(int j =1; j <= n; j++) { 

18                                      for(int t = j; t <= n; t += j){

19                     dp[i][t]+= dp[i-1][j];

20                     dp[i][t]%= mod; 

21         }

22       }

23     }

24     int ans =0;

25     for(int i =1; i <= n; i++)

26        ans =(ans + dp[k][i])% mod;

27     printf("%d\n", ans);

28   }

29   return0;

30 }

31  

 

 


 

你可能感兴趣的:(codeforces)