记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:9:14: warning: unused variable 'rec' [-Wunused-variable]
  ll ans = 1, rec = 0;
              ^~~
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 220.0 KiB
#2 Wrong Answer 1ms 216.0 KiB
#3 Wrong Answer 1ms 232.0 KiB
#4 Wrong Answer 1ms 220.0 KiB
#5 Wrong Answer 1ms 228.0 KiB
#6 Wrong Answer 1ms 220.0 KiB
#7 Wrong Answer 1ms 228.0 KiB
#8 Wrong Answer 1ms 220.0 KiB
#9 Wrong Answer 1ms 228.0 KiB
#10 Wrong Answer 1ms 220.0 KiB

代码

#include <cmath>
#include <iostream> 
typedef long long ll;
ll n, prime[ll(1e5)], top;
bool notPrime[ll(1e5)];
int main(){
	std::cin >> n;
	ll limit = std::min(ll(sqrt(n) + 10), n);
	ll ans = 1, rec = 0;
	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 ){
		ans = (ans * prime[i]) % 1000000007;
	}
	std::cout << ans;
	return 0;
}

信息

递交者
类型
递交
题目
篝题
语言
C++
递交时间
2020-12-23 09:31:16
评测时间
2020-12-23 09:31:16
评测机
分数
0
总耗时
15ms
峰值内存
232.0 KiB