Submit | All submissions | Best solutions | Back to list |
BCH - The Longest Chain |
Output the longest chain of integers which has the following properties:
- All integers are positive and have 4 digits in their decimal representation (i.e. all numbers are in the range [1000, 9999]).
- All numbers in the chain are different.
- The decimal representations of each number differs from the next one at only position (digit).
- All integers are prime.
The winner is the participant who obtains the longest chain.
Input
There is no input data in this problem.
Output
In the first line output the length of your chain N. In the next N lines output each number of your chain.
Score
The number of points you'll get for the given problem is calculated using following formula: score = 1000/(1062 - length), where length - length of your chain.
Example
Output: 3 9857 9887 9883 Score: In this case score = 1000/(1062-3) = 0.944287,
Problem author: Filimonenkov D.O.
Added by: | Roman Sol |
Date: | 2007-09-03 |
Time limit: | 1s-30s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE |
Resource: | ZCon 2008 |