Mock CCC '20 Contest 1 J5 - A Prime Problem

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 0.5s
Memory limit: 1G

Problem type

koosaga likes numbers which are constructed by concatenating two prime numbers together. A number which can be formed by concatenating two primes that both have at least D digits is a D-level prime pair certificate. Leading zeroes are not permitted.

Given two integers D and N, compute the smallest D-level prime pair certificate greater than or equal to N.

Constraints

The output will never exceed 2 \cdot 10^9.

There are no subtasks for this problem.

Input Specification

The input will consist of two positive space separated integers, D and N.

Output Specification

Output the smallest D-level prime pair certificate greater than or equal to N.

Sample Input

2 11328

Sample Output

11329

Comments


  • -3
    Togohogo1  commented on Feb. 29, 2020, 7:42 p.m. edit 3

    Does N or D in the input have leading zeros?

    I'm just wondering because I got WA on test case #642. It's probably because there is something else wrong with my program.

    Edit: Fixed the error