题目描述:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class HW03 {
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int target = Integer.parseInt(br.readLine());
int[] numbers = new int[target];
int count = 0;
int result = 0;
for(int i =2; i <= target; i++){
int judge = 0;
for(int j = 2; j < i;j++){
// 判断是否为质素
if(i % j == 0){
judge = 1;
break;
}
}
if(judge == 0){
numbers[count] = i;
count++;
}
}
for(int i = 0; i<count - 1; i++){
for(int j = i; j < count; j++){
if(numbers[i] + numbers[j] == target){
result++;
break;
}
}
}
System.out.println(result);
}
}