大佬帮帮 36分
查看原帖
大佬帮帮 36分
1141772
lanbohao0417楼主2024/5/14 17:30
#include<bits/stdc++.h>
using namespace std;
bool lan(long long x){
	for(int i=2;i*i<=x;i++){
		if(x%i==0){
			return false;
		}
	}
	return true;
}
int main(){
	long long l,r,ans=0;
	cin>>l>>r;
	for(int i=l;i<=r;i++){
		if(lan(i)){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}
2024/5/14 17:30
加载中...