2023年5月25日
摘要: 不好意思,题太简单了,不小心就秒了。 #include<bits/stdc++.h>using namespace std; bool f(int n){ if(n==1||n==2)return true; for(int i=2;i<=n/i;i++) { if(n%i==0)return fa 阅读全文
posted @ 2023-05-25 14:05 临江柔 阅读(9) 评论(0) 推荐(0) 编辑
  2023年5月24日
摘要: #include<bits/stdc++.h>using namespace std; int fun(int n){ int i; for(int i=2;i<=n/i;i++) { if(n%i==0)return 0; } return 1;} int main(){ int i,j,k,n, 阅读全文
posted @ 2023-05-24 09:48 临江柔 阅读(3) 评论(0) 推荐(0) 编辑
  2023年5月23日
摘要: 这个程序运行超时,思路是遍历所有的数,看是否合理。 #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;} 阅读全文
posted @ 2023-05-23 12:58 临江柔 阅读(3) 评论(0) 推荐(0) 编辑
  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 临江柔 阅读(6) 评论(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) 编辑
  2023年5月19日
摘要: 4.7分数比较 这个非常简单,通分然后比较分子的大小就可以 #include<bits/stdc++.h>using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; a=a*d;c=c*b; if(a>=b)puts("A"); el 阅读全文
posted @ 2023-05-19 11:31 临江柔 阅读(8) 评论(0) 推荐(0) 编辑
  2023年5月18日
摘要: 4.6多项式之和 流程图 代码实现 #include<bits/stdc++.h>using namespace std;const int MOD=1e9+7;int gcd(int a,int b){ return b?gcd(b,a%b):a;} void solve(){int i,n,j; 阅读全文
posted @ 2023-05-18 12:16 临江柔 阅读(9) 评论(0) 推荐(0) 编辑
  2023年5月17日
摘要: 对于正解我觉得代码有些长,不是很简洁; 我的思路是找出分子与40的最大公约数,然后同时除以2最大公约数; #include<bits/stdc++.h>using namespace std;const int MOD=1e9+7;int gcd(int a,int b){ return b?gcd 阅读全文
posted @ 2023-05-17 09:27 临江柔 阅读(11) 评论(0) 推荐(0) 编辑
  2023年5月16日
摘要: 4.4将真分数变为埃及分数 算法流程图 #include<bits/stdc++.h>using namespace std;const int MOD=1e9+7; void solve(){ long long a,b,c; cin>>a>>b; while(1) { if(b%a)c=b/a+ 阅读全文
posted @ 2023-05-16 15:02 临江柔 阅读(5) 评论(0) 推荐(0) 编辑