題目
題意:
給你表示,然後是否存在這樣的一個序列滿足
是一個正整數。
思路:
要滿足上述公式的話,那麼最後的值一定要爲,如果不爲的話,那麼肯定會出現使這個公式不成立的,比如和,那麼當的時候,就不同了,所以只有整除後纔會無論怎麼取模都爲,都符合公式,那麼最後能夠取模爲的話,那麼就是倍數的關係,比如說最後無論怎麼取都相當於,所以最後能取得就是倍數得關係,我們可以遍歷一下~,那麼此時對於每一個總共能夠取個數字,然後這其中要有一個最小這樣無論怎麼取都是得倍數,所以,最後的公式就是。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <cctype>
using namespace std;
typedef long long ll;
typedef vector<int> veci;
typedef vector<ll> vecl;
typedef pair<int, int> pii;
template <class T>
inline void read(T &ret) {
char c;
int sgn;
if (c = getchar(), c == EOF) return ;
while (c != '-' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-') ? -1:1;
ret = (c == '-') ? 0:(c - '0');
while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
ret *= sgn;
return ;
}
int xxxxxxxxx = 1;
inline void outi(int x) {if (x > 9) outi(x / 10);putchar(x % 10 + '0');}
inline void outl(ll x) {if (x > 9) outl(x / 10);putchar(x % 10 + '0');}
inline void debug(ll x) {cout << xxxxxxxxx++ << " " << x << endl;}
inline void debugs(string s) {cout << s << endl;}
const int maxn = 5e5 + 10;
const int mod = 998244353;
ll fac[maxn] = {0};
ll quickpow(ll a, ll b) {
ll ans = 1, base = a;
while (b) {
if (b & 1) ans = ans * base % mod;
base = base * base % mod;
b >>= 1;
}
return ans;
}
ll C(ll n, ll m) {
if (n < m) return 0;
return fac[n] * quickpow(fac[m] * fac[n - m] % mod, mod - 2) % mod;
}
int main() {
fac[0] = fac[1] = 1;
for (int i = 1; i <= maxn - 1; i++) fac[i] = fac[i - 1] * i % mod;
ll n, k, sum = 0;
read(n), read(k);
for (int i = 1; i <= n; i++) {
if (n / i - 1 >= k - 1) sum = (sum + C((ll)(n / i - 1), k - 1)) % mod;
else break;
}
outl(sum);
return 0;
}