【洛谷】P11169 「CMOI R1」Bismuth / Linear Sieve 的题解
题解
赛时没调出来,血亏。
先把题目里面的伪代码变成 C++ 代码
#include <bits/stdc++.h>
using namespace std;
unsigned long long n;
bool isNotPrime[10000005];
int primes[10000005];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
isNotPrime[i] = false;
}
long long cntp = 0;
long long counter = 0;
for (int i = 2; i <= n; i++) {
if (!isNotPrime[i]) {
cntp++;
primes[cntp] = i;

最低0.47元/天 解锁文章
6944

被折叠的 条评论
为什么被折叠?



