Test instructions: Give n, ask satisfies a+b=n and a, B are prime number of how many pairs
Make a list of primes, and then enumerate
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <stack>6#include <vector>7#include <map>8#include <algorithm>9 #definemod=1e9+7;Ten using namespacestd; One AtypedefLong LongLL; - intisp[100010]; - the voidIsPrime () { -isp[1]=isp[0]=1; - for(intI=2;i<100010; i++){ - if(isp[i]==0) + for(intj=i*2;j<100010; j+=i) -isp[j]=1; + } A } at - intMain () - { - IsPrime (); - intN,i,j,ans; - while(SCANF ("%d", &n)!=eof&&N) { inans=0; - for(i=2; i<=n/2; i++){ to if((!isp[i]) && (!isp[n-i]) ans++; + } -printf"%d\n", ans); the } * return 0; $}
View Code
Because the first two days to do a CF of a will be used to determine the prime number = = completely forget how to write---555555
HDU 1397 Goldbach ' s conjecture "prime hit table"