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 a , a+1 , ... , b (a<=b) . You want to find the minimum integer l (1<=l<=b−a+1) such that for any integer x (a<=x<=b−l+1) among l integers x , x+1 , ... , x+l−1 there are at least k prime numbers.
Find and print the required minimum l . If no value l meets the described limitations, print -1.
输入格式
A single line contains three space-separated integers a,b,k ( 1<=a,b,k<=106; a<=b ).
输出格式
In a single line print a single integer — the required minimum l . 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