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; ^~~
代码
#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