记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 2ms 2.215 MiB
#2 Accepted 2ms 2.215 MiB
#3 Accepted 2ms 2.223 MiB
#4 Accepted 2ms 2.211 MiB
#5 Accepted 2ms 2.223 MiB
#6 Time Exceeded ≥1000ms ≥97.492 MiB
#7 Time Exceeded ≥1000ms ≥66.59 MiB
#8 Time Exceeded ≥1002ms ≥95.754 MiB
#9 Time Exceeded ≥1001ms ≥93.953 MiB
#10 Time Exceeded ≥1005ms ≥73.84 MiB

代码

#include <cmath>
#include <iostream> 
//after
typedef long long ll;
const ll P = 1000000007;
ll n, prime[ll(1e8) + 10], top;
bool notPrime[ll(1e8) + 10];
int main(){
	std::cin >> n;
	ll limit = n;
	ll ans = 1;
	for(int i = 2 ; i <= limit ; ++i){
		if(!notPrime[i])
			prime[++top] = i;
		for(int j = 1 ; prime[j] * i <= limit && j <= top; ++j){
			notPrime[prime[j] * i] = true;
		}
	}
	for(int i = 1 ; prime[i] <= n && i <= top; ++i ){
		ll temp = prime[i];
		while(temp * prime[i] <= n) 
			temp *= prime[i];
		ans = (ans * (temp % P)) % P;
	}
	std::cout << ans;
	return 0;
}

信息

递交者
类型
递交
题目
篝题
语言
C++
递交时间
2020-12-23 11:37:09
评测时间
2020-12-23 11:37:10
评测机
分数
50
总耗时
≥5022ms
峰值内存
≥97.492 MiB