HDU 2138 How many prime numbers 題解

由題意得: 1.輸入一個數n,並隨後輸入n個數 2.輸出n個數中素數的個數 3.代碼如下: #include<iostream> #include<cmath> using namespace std; bool sieve(int num) { if(num==1) return false; else{ int t=sqrt(num);//縮小範圍 若直接i<num 會超時
相關文章
相關標籤/搜索