[Offer收割]编程练习赛23 register

Ended

Participants:430

Verdict:Wrong Answer
Score:20 / 100
Submitted:2017-08-20 13:42:21

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
int n,k,ans;
void dfs(int cur,int pre){
    if(cur==n){
        ans++;
        ans%=MOD;
        return;
    }
    int beg=(cur==0)?1:0;
    for(int i=beg;i<=k;i++){
        if(i*pre>k) continue;
        dfs(cur+1,i);
    }
}
int main(){
    scanf("%d%d",&n,&k);
    ans=0;dfs(0,1);
    printf("%d\n",ans);
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX