2023年5月22日
摘要: 5.3 #include<bits/stdc++.h>using namespace std; int a[500]; int fun(int i){ int j; if(i<=1)return 0; if(i==2)return 1; if(i%2==0)return 0; for(j=3;j<= 阅读全文
posted @ 2023-05-22 22:18 临江柔 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 5.2 #include<bits/stdc++.h>using namespace std; int fun(int n){ int i; if(n==2)return 1; if(n%2==0)return 0; for(i=3;i<=sqrt(n);i+=2) { if(n%i==0)retu 阅读全文
posted @ 2023-05-22 22:12 临江柔 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 5.1素数 #include<bits/stdc++.h>using namespace std;bool f(int x){ for(int i=2;i<=x/i;i++) { if(x%i==0)return false; } return true;} int main(){ int l,r; 阅读全文
posted @ 2023-05-22 21:38 临江柔 阅读(3) 评论(0) 推荐(0) 编辑