...
2023-08-15 19:06:12
发布于:广东
8阅读
0回复
0点赞
#include<iostream>
using namespace std;
int s[100005];
int a[100005];
int main(){
a[1] = 1;
int cnt = 0;
for(int i = 2;i <= 10000;i++){
if(a[i] == 0) s[cnt] = i;
for(int j = i * 2;j <= 10000;j += i) a[j] = 1;
}
int n;
cin >> n;
for(int i = 4;i <= n;i += 2){
for(int j = 1;j <= cnt;j){
bool h = false;
for(int k = j;k <= cnt;k++){
if(i == s[j] + s[k]){
cout << i << "=" << s[j] << "+" << s[k] << endl;
h = true;
break;
}
}
if(h == true) break;
}
}
return 0;
}
这里空空如也
有帮助,赞一个