You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
534 B
24 lines
534 B
#include<bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
bool isPrime(int number) {
|
|
for (int i = 2; i * i <= number; i++)
|
|
if (number % i == 0)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
int main() {
|
|
int n;//输入的数
|
|
cin >> n;
|
|
//计算从4开始到这个指定数字结束
|
|
for (int i = 4; i <= n; i += 2) {
|
|
for (int j = 2; j < i; j++) {
|
|
if (isPrime(j) && isPrime(i - j)) {
|
|
cout << i << "=" << j << "+" << i - j << endl;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |