Follows 686.c (Total 32 lines):

/* @JUDGE_ID:4461XX 686 C */
/* A */
#include <stdio.h>
int prime(unsigned long n);
void print(long pairs);

void main(void)
{
	unsigned long number,i,a,b;
	while(scanf("%lu",&number)==1)
	{
		long pairs=0;
		if(number==0)break;
		for(i=2;i<=number/2;i++)
		{
			a=prime(i);b=prime(number-i);
			if(a==1&&b==1)pairs++;
		}
		print(pairs);
	}
}
int prime(unsigned long n)
{
	unsigned long i;
	if(n==2)return 1;
	else for(i=2;i<=n/2;i++)if(n%i==0)return 0;
	return 1;
}
void print(long pairs)
{
	printf("%ld\n",pairs);
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com