解题思路:
注意事项:
参考代码:
#include <stdio.h>
int main(void)
{
int i, j, k, n, count, count1;
int num[10000];
scanf("%d", &n);
for (i = 3, num[0] = 2, j = 1;i < n;i++)
{
count1 = 0;
for (k = 2;k < i;k++)
{
if (i%k == 0)
{
count1 = 1;
break;
}
}
if (count1 != 1)
{
num[j] = i;
j++;
}
}
count = 0;
for (i = 0;i < j;i++)
{
if (num[i] > n / 2)
break;
for (k = j - 1;k > 0 ;k--)
{
if (num[i] + num[k] == n)
count++;
}
}
printf("%d", count);
return 0;
}
0.0分
0 人评分