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.
hide comments
Samil Vargas:
2013-12-22 03:46:04
it should be partial or clasical! |
|
Maxim Bogoyavlenskiy:
2013-02-18 16:33:05
tutorial????? o_O |
Added by: | Roman Sol |
Date: | 2007-09-03 |
Time limit: | 1s-30s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | ZCon 2008 |