Polish version    English version  
  History of OI -> VIII OI 2000/2001 -> Problems

 About Olympic
 History of OI
XVII OI 2009/2010
XVI OI 2008/2009
XV OI 2007/2008
XIV OI 2006/2007
XIII OI 2005/2006
XII OI 2004/2005
XI OI 2003/2004
X OI 2002/2003
IX OI 2001/2002
VIII OI 2000/2001
Stage III - results
Stage II - results
Stage I - results
VII OI 1999/2000
VI OI 1998/1999
V OI 1997/1998
IV OI 1996/1997
III OI 1995/1996
II OI 1994/1995
I OI 1993/1994
 OI books
 National team
 Olympic camps
 Photo gallery
VIII Olimpiada Informatyczna 2000/2001

Task: GOL
Author: Wojciech Guzicki
Weaker Goldbach

II stage contest, the trial day  

In the year of 1742 C. Goldbach wrote in his letter to L. Euler that according to him each integer n>5 was the sum of three prime numbers (a prime number is an integer n>1, which has only two positive, integer divisors: 1 and n.). Euler answered, that Golbach's statement was equal to the one, that each even number n>=4 was the sum of two prime numbers. However, it did not make them any closer to the solution of the basic problem: is it really so? At the present we know that this statement is true for numbers up to 1011 (and we know much more, but this hypothesis is still an open problem). We are not about to verify that, but we will try to solve a less ambitious problem. Each integer n>=10 is the sum of different odd prime numbers. 


Write a program which:

  • reads integers from the text file GOL.IN, 
  • finds their decompositions into the sums of different odd prime numbers,
  • writes the results in the text file GOL.OUT. 

There could be many of such decompositions. Your program can find any of them. 


In the first line of the text file GOL.IN there is one positive integer n, n<=40. In each of the following n lines there is one integer from the interval [10,...,2 000 000 000]. 


Decomposition of the number k has to be written in two lines. In the first line one integer m>=1 should be written, this is the number of addends of the decomposition. In the second line m different odd numbers should be written in ascending order. Their sum should be equal to k, and they should be separated by single spaces. The decompositions should appear in the same order as the integers in the input file.


For the input file GOL.IN:


the correct answer is the output file GOL.OUT:

5 7 11 17 19
3 5 7

Print friendly version