文章
43
粉丝
180
获赞
21
访问
196.0k
#include <iostream>
using namespace std;
int a, b;
bool is_prime(int x)
{
for (int i = 2; i <= x / i; i ++ )
if (x % i == 0) return false;
return true;
}
int main()
{
while (cin >> a >> b)
{
int cnt = 0;
for (int i = min(a, b); i <= max(a, b); i ++ )
if (is_prime(i)) cnt ++;
cout << cnt << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发