acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 题解

    先埃式筛一遍,再遍历判断 时间复杂度:O(n2)O(n^2)O(n2)

    userId_undefined

    复仇者_帅童

    小有名气CSP-J一等奖出题人
    20阅读
    0回复
    1点赞
  • 哥德巴赫猜想题解

    userId_undefined

    ༺ཌༀ元气满满ༀད༻

    出道萌新秩序白银
    6阅读
    0回复
    0点赞
  • 题解(A21445.哥德巴赫猜想)

    #include<bits/stdc++.h> using namespace std; int n,x,y; bool ss(int x){ if(x1){ return false; } for(int j=2;j<=x/j;j++){ if(x%j0){ return false; } } return true; } void gd(int m){ for(x=1;x<=m;x++){ y=m-x; if(ss(y)==true&&ss(x)true){ break; } } } int main(){ cin>>n; for(int i=4;i<=n;i++){ if(i%20){ gd(i); cout<<i<<'='<<x<<'+'<<y<<endl; }else{ continue; } } return 0; }

    userId_undefined

    wy

    6阅读
    0回复
    0点赞
  • 题解

    #include <bits/stdc++.h> using namespace std; int n; map<int,bool>prime; bool is_prime(int x){ for(int i=2;i<=x/i;i++){ if(x%i0)return false; }return true; }void find_prime(){ int i=2; while(i<=n){ if(is_prime(i)){ prime[i]=true; }i++; } } void to_choose(int x){ for(auto it:prime){ if(prime.find(x-it.first)!=prime.end()){ cout<<x<<"="<<it.first<<"+"<<x-it.first<<"\n"; return; } } } int main() { cin>>n; find_prime(); for(int i=4;i<=n;i++){ if(i%20)to_choose(i); } return 0; }

    userId_undefined

    何浩天

    时间刺客空间掌握者
    3阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页