Submit | All submissions | Best solutions | Back to list |
KDEL - Removing digits |
English | Vietnamese |
Bom loves arithmetic very much. He is currently examining the numbers formed by writing the prime numbers successively. Accordingly, the nth number of this kind is formed by writing the first, second, ..., and up to nth prime number successively. The first few ones are:
2, 23, 235, 2357, 235711, ...
Bom denotes the nth number in the above sequence by an.
Write a program that helps Bom delete k digits from an so that the number formed by the remaining digits is maximized.
Input
A single line containing two integers n and k (1 ≤ n ≤ 50000, k ≥ 0 and k is smaller than the number of digits of an).
Output
Print in a single line the maximum number obtained by deleting exactly k digits from an.
Example
Input 5 4 Output 71
Added by: | Jimmy |
Date: | 2008-07-04 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 SCM qobi VB.NET |
Resource: | VNOI Marathon '08 - Round 5/DivB Problem Setter: Ngô Minh Đức |