[LeetCode] Count Primes - 素數系列問題

題目概述: Description: Count the number of prime numbers less than a non-negative number, n. 解題方法: 題意是給出n中所有素數的個數。 首先你需要知道判斷一個數是不是素數的方法:(最笨方法但有效) bool IsPrime(int n) { if (n<2) { //小於2的數即不是合數也不是素
相關文章
相關標籤/搜索