素數的優化求法

在數比較大的時候,通常的素數只須要比較到數的根號便可,以下代碼web #include <stdio.h> #include <math.h> int main(){ unsigned int a,b,c; int j,k; scanf("%d",&a); for(int i=2;i<a;i++){ for(j=2;j<=sqrt(i);j++){
相關文章
相關標籤/搜索