Description:
Count the number of prime numbers less than a non-negative number, n.
厄拉多塞筛法
public class Solution {
public int countPrimes(int n) {
int[] res=new int[n];
int count=0;
for(int i=2;i<n;i++){
if(res[i]==0){
count++;
for(int j=1;i*j<n;j++){
res[i*j]=1;
}
}
}
return count;
}
}