JerryLi • 1年前
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int a){
for(int i=2;i<=sqrt(a);i++){
if(a%i==0) return 1;
}
return 0;
}
void f(int a){
for(int i=2;i<=a/2;i++){
if(isPrime(i)!=0) continue;
int n = a-i;
if(isPrime(n)==0){
cout << a << "=" << i << "+" << n << endl;
return;
}
}
}
int main(){
int a,b;
cin >> a >> b;
for(int i=a;i<=b;i++){
if(i%2!=0) continue;
f(i);
}
}
评论: