CF237C.Primes on Interval

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.

Consider positive integers aa , a+1a+1 , ...... , bb (a<=b)(a<=b) . You want to find the minimum integer ll (1<=l<=ba+1)(1<=l<=b-a+1) such that for any integer xx (a<=x<=bl+1)(a<=x<=b-l+1) among ll integers xx , x+1x+1 , ...... , x+l1x+l-1 there are at least kk prime numbers.

Find and print the required minimum ll . If no value ll meets the described limitations, print -1.

输入格式

A single line contains three space-separated integers a,b,ka,b,k ( 1<=a,b,k<=106; a<=b1<=a,b,k<=10^{6}; a<=b ).

输出格式

In a single line print a single integer — the required minimum ll . If there's no solution, print -1.

输入输出样例

  • 输入#1

    2 4 2
    

    输出#1

    3
    
  • 输入#2

    6 13 1
    

    输出#2

    4
    
  • 输入#3

    1 4 3
    

    输出#3

    -1
    
首页