304934: CF937B. Vile Grasshoppers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Vile Grasshoppers

题意翻译

给你两个数 p,y ,求去掉2~y中所有2~p的数的倍数后剩下的最大值! 没有则输出 -1;

题目描述

The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape. The pine's trunk includes several branches, located one above another and numbered from $ 2 $ to $ y $ . Some of them (more precise, from $ 2 $ to $ p $ ) are occupied by tiny vile grasshoppers which you're at war with. These grasshoppers are known for their awesome jumping skills: the grasshopper at branch $ x $ can jump to branches ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF937B/e256171e16de0ce2bc4667496d6c5befd611ffc8.png). Keeping this in mind, you wisely decided to choose such a branch that none of the grasshoppers could interrupt you. At the same time you wanna settle as high as possible since the view from up there is simply breathtaking. In other words, your goal is to find the highest branch that cannot be reached by any of the grasshoppers or report that it's impossible.

输入输出格式

输入格式


The only line contains two integers $ p $ and $ y $ $ (2<=p<=y<=10^{9}) $ .

输出格式


Output the number of the highest suitable branch. If there are none, print -1 instead.

输入输出样例

输入样例 #1

3 6

输出样例 #1

5

输入样例 #2

3 4

输出样例 #2

-1

说明

In the first sample case grasshopper from branch $ 2 $ reaches branches $ 2 $ , $ 4 $ and $ 6 $ while branch $ 3 $ is initially settled by another grasshopper. Therefore the answer is $ 5 $ . It immediately follows that there are no valid branches in second sample case.

Input

题意翻译

给你两个数 p,y ,求去掉2~y中所有2~p的数的倍数后剩下的最大值! 没有则输出 -1;

加入题单

上一题 下一题 算法标签: