#include "iostream"
#include "math.h"
using namespace std;
int prime(int n)
{
int i, k;
k = sqrt(double(n));
if(n == 1)
return 1;
for (i = 2; i <= k; i++)
{
if (n % i == 0)
return 0;
}
return 1;
}
int main()
{
int num, count;
while (cin >> num && num)
{
count = 0;
int p1, p2;
for (p1 = 2; p1 <= num/2; p1++)
{
if (prime(p1))
{
p2 = num - p1;
if (prime(p2))
count++;
}
}
cout << count << endl;
}
}
zoj 1657 Goldbach's Conjecture
最新推荐文章于 2021-01-29 20:44:45 发布