题解 | #KiKi求质数个数#
KiKi求质数个数
http://www.nowcoder.com/practice/d3a404ee0f8d41f98bf4707035d91086
#include <iostream>
using namespace std;
bool is_zs(int n)
{
int i=2;
for (;i<n;i++)
{
if (n%i==0)
{
return 0;
break;
}
}
if (i==n)
return 1;
}
int main ()
{
int temp=0;
for (int i=100;i<1000;i++)
if (is_zs(i))
temp++;
cout<<temp;
}
查看12道真题和解析