輸入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......
閱讀全文