3 条题解

  • 0
    @ 2024-1-13 21:26:20

    #include #include #include #include<math.h> using namespace std; bool zs(int n){ if(n 0 or n1) return false; for(int i=2;i<=sqrt(n);i++){ if(n%i==0) return false; } return true; } int main(){ int a,b; cin>>a>>b; for(int i=a;i<=b;i++) if(zs(i)) cout<<i<<" "; return 0; }

    • 0
      @ 2023-11-5 9:03:02
      #include<iostream>
      #include<string>
      #include<algorithm>
      #include<math.h>
      using namespace std;
      bool zs(int n){
      	if(n ==0 or n==1)
      		return false;
      	for(int i=2;i<=sqrt(n);i++){
      		if(n%i==0)
      			return false;
      	}
      	return true;
      }
      int main(){	 //12级 区间里的质数 
      	int a,b;
      	cin>>a>>b;
      	for(int i=a;i<=b;i++)
      		if(zs(i))
      			cout<<i<<" ";
      	return 0;
      }
      
      • 0
        @ 2023-4-13 21:23:10
        • 1

        信息

        ID
        580
        时间
        1000ms
        内存
        256MiB
        难度
        7
        标签
        递交数
        14
        已通过
        12
        上传者