CF 805A FAKE NP

A. Fake NP
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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
Copy
19 29
output
2
input
Copy
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}.

题目

看了看数据范围,暴力肯定没法做,也没想到什么好的方法,看一眼过去交的,竟然是判断左右边界是否相等,相等的话输出自己肯定没错,不用再求因子,不同的话就输出2,因为所有偶数都可被2整除

没有思路就该写几个试试,说不定就找到规律了

#include<stdio.h>
int main()
{
	int l,r;
	scanf("%d%d",&l,&r);
	if(l==r)
		printf("%d\n",l);
	else
		printf("2\n");
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值