蒜头君想要找到一个正整数 X,使得 1 到 45 这 45 个整数中,至多有一个整数不能整除 X。满足条件的 X 显然有很多个,于是蒜头君想请你找到最小的满足条件的 X。
#include <iostream>
#define LL long long
using namespace std;
LL gcd(LL x, LL y)
{
return y ? gcd(y, x % y) : x;
}
int main()
{
LL ans = 1;
for (int i = 1; i <= 45; i++)
{
if (i != 43)
{
ans = ans / gcd(i, ans) * i;
}
}
cout << ans << endl;
return 0;
}