#include using namespace std;

int main() { int n, p; cin >> n >> p;

// 初始化数列长度为0
int length = 0;
// 初始化数列是否满足条件为false
bool satisfy = false;

while (!satisfy) {
    length++;
    // 判断数列是否满足条件
    satisfy = true;
    for (int i = 1; i <= n; i++) {
        if (length % i == 0) {
            satisfy = false;
            break;
        }
    }
}

// 输出答案对p取模的值
cout << length % p << endl;

return 0;

原文地址: http://www.cveoy.top/t/topic/hTye 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录