最后两个点卡不过去求助qwq
查看原帖
最后两个点卡不过去求助qwq
220824
yyz1005楼主2023/5/31 09:54
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e8+10;
const ll mod = 1e8+7;
ll n;
vector<ll> Pri;
vector<ll> muls;
bitset<100000005> usp;
ll res = 1;
void init(){
	usp[0] = usp[1] = 1;
	for(ll i = 2; i <= n; i++){
		if(!usp[i]){Pri.push_back(i);muls.push_back(i);res = res*i%mod;}
		for(auto j = 0; j < Pri.size(); j++){
			if(i*Pri[j]>n) break;
			usp[i*Pri[j]] = 1;
			if(i%Pri[j]==0){
				//printf("%lld mod %lld ==0\n",i,Pri[j]);
				if(i==muls[j]){
					//printf("%lld==%lld\n",i,muls[j]);
					muls[j]*=Pri[j];
					res*=Pri[j];
					res%=mod; 
				}
				break;
			}
		}
	}
}
/*
ll calc(ll x){
	ll p = 1,q = 0;
	while(n>=p){
		q++;
		p*=x;
	}
	q--;
	return q;
}
ll mul(ll x,ll k){
	ll res = 1;
	while(k){
		if(k&1) res = res*x%mod;
		x = x*x%mod;
		k>>=1;
	}
	return res;
}
*/
int main(){
	scanf("%lld",&n);
	init();
	printf("%lld",res);
	return 0;
}
2023/5/31 09:54
加载中...