using namespace std;
int
#include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int dp[n + 1];
int suff[n + 2];
dp[n] = 1;
suff[n] = 1;
suff[n + 1] = 0;
for (int i = n - 1; i >= 1; i--) {
dp[i] = suff[i + 1];
for (int b = 2; b <= n / i; b++) {
dp[i] += suff[b * i] - suff[min(n + 1, b * i + b)];
while (dp[i] < 0)
dp[i] += m;
dp[i] %= m;
}
suff[i] = suff[i + 1] + dp[i];
suff[i] %= m;
}
cout << dp[1] << endl;
}
博客内容遵循 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议本文永久链接是:https://shushuwoa.com/2021/08/24/Codeforces-Round-740/