家人们,谁懂啊,40分
查看原帖
家人们,谁懂啊,40分
677581
_Glassy_Sky_楼主2023/9/12 20:45
#include<bits/stdc++.h>
using namespace std;
bool f(long long x)
{
	if(x <= 1)
		return 0;
	for(int i = 2; i * i <= x; i ++)
		if(x % i == 0)
			return 0;
	return 1;
}
int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	long long a, b, ans = 0;
	cin >> a >> b;
	for(int i = a; i <= b; i ++)
		if(f(i))
		 	ans ++;
	cout << ans;
	return 0;
}

2023/9/12 20:45
加载中...