#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <climits>
using namespace std;
//1440
const int maxn=2<<14+1;
bool Hash[maxn];
void init(){
memset(Hash,false,sizeof(Hash));
for(int i=2;i<maxn;i++){
if(Hash[i]) continue;
for(int j=i*2;j<maxn;j+=i)
Hash[j]=true;
}
}
int main(){
init();
int n;
//freopen("input.txt","r",stdin);
while(cin>>n&&n!=0){
int cnt=0;
for(int i=2;i<n/2;i++)
if(!Hash[i]&&!Hash[n-i])
cnt++;
if(n%2==0&&!Hash[n/2])
cnt++;
printf("%d\n",cnt);
}
return 0;
}
/**************************************************************
Problem: 1440
User: cust123
Language: C++
Result: Accepted
Time:10 ms
Memory:1584 kb
****************************************************************/
题目1440:Goldbach's Conjecture
最新推荐文章于 2022-01-23 12:00:00 发布