1 #include<iostream>
 2 #include<cmath>
 3 using namespace std;
 4 int x,y,cnt=0;
 5 bool iss(int x)
 6 {
 7     if(x==1)return false;
 8     for(int i=2;i*i<=x;i++)
 9         if(x%i==0)return false;
10     return true;
11 }
12 int main()
13 {
14     cin>>x>>y;
15     if(x>y)swap(x,y);
16     for(int i=x;i<=y;i++)if(iss(i))cnt++;
17     cout<<cnt;
18     return 0;
19 }

(可以设置陷阱数据)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2022-01-18
  • 2022-01-25
  • 2022-12-23
猜你喜欢
  • 2021-06-28
  • 2021-11-22
  • 2021-06-30
  • 2021-12-18
相关资源
相似解决方案