高手给编个程序~C++

来源:百度知道 编辑:UC知道 时间:2024/06/05 08:31:30
Program 3: Goldbach's conjecture
For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such that
n = p1 + p2
This conjecture has not been proved nor refused yet. No one is sure whether this conjecture actually holds. However, one can find such a pair of prime numbers, if any, for a given even number. The problem here is to write a program that reports the number of all the pairs of prime numbers satisfying the condition in the conjecture for a given even number.
A sequence of even numbers is given as input. There can be many such numbers. Corresponding to each number, the program should output the number of pairs mentioned above. Notice that we are interested in the number of essentially different pairs and therefore you should not count (p1, p2) and (p2, p1) separately as two different pairs.
Input Format: (a3.in)
An integer is given in each input line. You may assume that each integer is even, and

一般情况下,大于等于4合数都会被拆分成两个质数的和,这样质数对至少有一对,比如25=2+23。输入是一个合数序列,要求找出找出每个合数所有的质数对,以25为例(2,23)与(23,2)算作一对。程序要求只求4-215之间的合数即可,不在此范围不用理会。
ACM的题么?算法应该有时间和内存的限制吧。只要写一个判断质数的函数,就行了。

你先把他翻译成中文不行吗
其实高手是不会来这里的,高手也怕麻烦的