标签:code 其他 .com prim art etc csdn res ret
class Solution { public: int countPrimes(int n) { if(n < 2) return 0; bool result[n]; for(int i = 0;i < n;i++) result[i] = false; int count = 0; for(int i = 2;i < n;i++){ if(result[i] == false){ count++; for(int j = 1;j * i < n;j++) result[j*i] = true; } } return count; } };
https://www.jianshu.com/p/12c0e91c696e
https://blog.csdn.net/github_39261590/article/details/73864039 图解
标签:code 其他 .com prim art etc csdn res ret
原文地址:https://www.cnblogs.com/ymjyqsx/p/9652186.html