36分求助
查看原帖
36分求助
759261
wangweichen666楼主2022/8/22 16:20
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,i,j,s;
    s=0;
    cin>>a>>b;
    for(i=a;i<=b;i++){
    	int sq=sqrt(i);
        bool pr=true;
        for(j=2;j<=sq;j++){
            if(i%j==0){
            	pr=false;
                break;
            }
        }
        if(pr==true){
        	s++;
			}
		}
		cout<<s;
    return 0;
}
2022/8/22 16:20
加载中...