输入n,求n以内的所有素数
算法用两个数组存储数据:
一个是prime[],存储n以内所有的素数,其index为pi,初值为0
一个是is_prime[i],表示自然数i(i<=n)是不是质数。
算法如下:
linear_prime_sieves
1: set is_prime[] to true
2: for i=2 to n
3: if is_prime[i]=true then prime[pi++]=i
4: for j=0 to pi-1
5: if prime[j]*i>n then exit loop_j
6: is_prime[prime[j]*i]=false
7: if i mod prime[j]=0 then exit loop_j
8: endif
9: endif
这个算法有两层循环,第一层遍历2到n之间的所......
阅读全文
如果在冲突发生的时候代码库中的版本是19,而A保持着18的版本号,当A提交的时候发生冲突,那么使用 resolve the conflict by using the base version of the file 说明以18内容为准(A修改的内容也会被原始18版本覆盖),版本号改变为19,此时文件为被修改状态。
resolve the conflict by using the incoming version of the file如果发生冲突就以代码库中为准,版本号使用服务器上的版本号。即使用19为版本号,文件为 未被修改状态,即完全使用19的内容和版本号。
resolve the conflict by using my version......
阅读全文