数据太水,O(n log n)轻松过
查看原帖
数据太水,O(n log n)轻松过
700558
williamwei楼主2024/8/11 18:05
#include <iostream>
#include <bitset>
using namespace std;
typedef long long ll;
const int maxn = 1e8 + 10;
const int mod = 1e8 + 7;
int n, ans = 1;
bitset<maxn> v;
int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 2; i <= n; i++) if (!v[i]) {
		int cur = i;
		while ((ll)cur * i <= n) cur *= i;
		ans = (ll)ans * cur % mod;
		for (int j = i + i; j <= n; j += i) v[j] = true;
	} cout << ans << '\n';
	return 0;
}

建议加强数据

2024/8/11 18:05
加载中...