1007. 素數對猜測 (20) 判斷素數注意事項 i<=sqrt(n)

下面是我寫的:ios #include<cstdio>spa #include<cmath> int isprime(int n){ int temp=sqrt(n); for(int i=2;i<=temp;i++){ if(n%i==0){ return 0; } }    return 1; } int main(){ int n,temp=2,count=0; scanf("%d",&n)
相關文章
相關標籤/搜索