码迷,mamicode.com
首页 > 其他好文 > 详细

2017-5-5-Train:Codeforces Round #411 (Div. 2)

时间:2017-05-05 14:13:11      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:div   number   input   fence   and   win   isp   image   lock   

A. Fake NP(数论水题)

Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.

You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Find the integer that we wrote down the maximum number of times.

Solve the problem to show that it‘s not a NP problem.

Input

The first line contains two integers l and r (2 ≤ l ≤ r ≤ 109).

Output

Print single integer, the integer that appears maximum number of times in the divisors.

If there are multiple answers, print any of them.

Examples

input

19 29

output

2

input

3 6

output

3

Note

Definition of a divisor: https://www.mathsisfun.com/definitions/divisor-of-an-integer-.html

The first example: from 19 to 29 these numbers are divisible by 2: {20, 22, 24, 26, 28}.

The second example: from 3 to 6 these numbers are divisible by 3: {3, 6}

技术分享

Code:

技术分享
 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int l , r;
 4 int main()
 5 {
 6     int pre = 0 , tail = 0 , sum = 0 , pos = -1;
 7     scanf("%d%d" , &l , &r);
 8     if(l == r)
 9         printf("%d" , l);
10     else
11         printf("2");
12 }
View Code

 

2017-5-5-Train:Codeforces Round #411 (Div. 2)

标签:div   number   input   fence   and   win   isp   image   lock   

原文地址:http://www.cnblogs.com/jianglingxin/p/6812535.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!