nt prim[MAX] = {1}, s[MAX],l=0; void prime() { int i, j; memset(prim, 0, sizeof(prim)); for (i = 2; i < MAX; i++) { if (prim[i])continue; for (j = i + i; j < MAX; j += i) { prim[j] = 1; } s[l++] = i; } //s里面保存的是2-MAX的素数 }
2024-03-11 23:47:31
nt prim[MAX] = {1}, s[MAX],l=0; void prime() { int i, j; memset(prim, 0, sizeof(prim)); for (i = 2; i < MAX; i++) { if (prim[i])continue; for (j = i + i; j < MAX; j += i) { prim[j] = 1; } s[l++] = i; } //s里面保存的是2-MAX的素数 }