组合数学+结论——cf1359E

/*
求sum{C(n/i,k)}
*/

#include<bits/stdc++.h> using namespace std; #define N 500005 #define mod 998244353 #define ll long long ll n,k,ans; int F[N], Finv[N], inv[N];///F是阶层 Finv是逆元的阶层 void init(){ inv[1] = 1; for(int i = 2; i < N; i++) inv[i] = (mod - mod/i) * 1ll * inv[mod % i] % mod; F[0] = Finv[0] = 1; for(int i = 1; i < N; i++){ F[i] = F[i-1] * 1ll * i % mod; Finv[i] = Finv[i-1] * 1ll * inv[i] % mod; } } int comb(int n, int m){ /// C(n,m) if(m < 0 || m > n) return 0; return F[n] * 1ll * Finv[n-m] % mod * Finv[m] % mod; } int main(){ init(); cin>>n>>k; for(int i=1;i<=n;i++) ans=(ans+comb(n/i-1,k-1))%mod; cout<<ans<<'\n'; }

 

posted on 2020-05-29 11:20  zsben  阅读(217)  评论(0编辑  收藏  举报

导航