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
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}.

——————————————————————————————————————

题目的意思是给出l和r求l到r之间每个数因子最多的是几?

思路,分析可知道如果l与r相等那答案就是l,否则2肯定最多

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define inf 0x3f3f3f3f
#define LL long long int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a==b) printf("%d\n",a);
else printf("2\n");
return 0;
}

Codeforces805 A. Fake NP 2017-05-05 08:30 327人阅读 评论(0) 收藏的更多相关文章

  1. 周赛-Heros and Swords 分类: 比赛 2015-08-02 08:30 11人阅读 评论(0) 收藏

    Heros and Swords Time Limit: 6000/3000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Su ...

  2. Codeforces805 C. Find Amir 2017-05-05 08:41 140人阅读 评论(0) 收藏

    C. Find Amir time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  3. c#委托和事件(下) 分类: C# 2015-03-09 08:42 211人阅读 评论(0) 收藏

    C#中的委托和事件(下) 引言 如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...

  4. .net 实现Office文件预览 Word PPT Excel 2015-01-23 08:47 63人阅读 评论(0) 收藏

    先打个广告: .Net交流群:252713569 本人QQ :524808775 欢迎技术探讨, 近期公司要求上传的PPT和Word都需要可以在线预览.. 小弟我是从来没有接触过这一块的东西 感觉很棘 ...

  5. walk around by The provided App differs from another App with the same version and product ID 分类: Sharepoint 2015-07-05 08:14 4人阅读 评论(0) 收藏

    'm currently developing a SharePoint 2013 application. After a few deployments via Visual Studio, I ...

  6. hdu 1047 (big integer sum, fgets or scanf, make you func return useful infos) 分类: hdoj 2015-06-18 08:21 39人阅读 评论(0) 收藏

    errors made, boundary conditions, <= vs < , decreasing vs increasing , ++, –, '0'/'1' vs 0/1 p ...

  7. A simple problem 分类: 哈希 HDU 2015-08-06 08:06 1人阅读 评论(0) 收藏

    A simple problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) To ...

  8. 周赛-Integration of Polynomial 分类: 比赛 2015-08-02 08:40 10人阅读 评论(0) 收藏

    Integration of Polynomial Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/O ...

  9. 周赛-KIDx's Pagination 分类: 比赛 2015-08-02 08:23 7人阅读 评论(0) 收藏

    KIDx's Pagination Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) S ...

随机推荐

  1. 【344】Jupyter relevant problems

    参考:Jupyter Notebook Tutorial: The Definitive Guide 参考:ipython notebook 如何修改一开始打开的文件夹路径? Ref: Install ...

  2. smartos介绍

    https://wiki.smartos.org A Little History 2005年,Sun Microsystems开源了其著名的Unix操作系统Solaris,最终被发布为一个名为Ope ...

  3. debug-stripped.ap_' specified for property 'resourceFile' does not exist.(转载)

    1.错误描述 更新Android Studio到2.0版本后,出现了编译失败的问题,我clean project然后重新编译还是出现抑郁的问题,问题具体描述如下所示: Error:A problem ...

  4. exception keynote

    [exception keynote] Note that the parentheses around this tuple are required, because except ValueEr ...

  5. java swing:文本框添加滚动条

    有几点要注意: 1.默认的滚动条,仅在输入的文本超过文本框时才会显示..没有超过文本框是不会显示的: 2.设置矩形大小,是在滚动条上设置,而不是在文本框上设置: 示例代码如下: public clas ...

  6. 6-Linux 上mysql的常用命令 以及 tomcat的相关指定

    mysql -u root -p 进入Mysql //注意一下有逗号!!! show databases; //显示所有的数据库 drop database mydb; // 删除mydb这个数据库 ...

  7. 如何区分USB 2.0 和USB 3.0插口

    USB3.0的速度是USB2.0的十倍,并且比USB2.0更加节能,同时,还能向下兼容USB2.0.那么,我们怎么区分USB2.0 和 USB 3.0呢. 电脑(有USB2.0和USB3.0的插口) ...

  8. CentOS日志列表

    anaconda/* 包含至少5个日志文件:anaccmda.log用于保存一般安装消息:anaconda.packaging.log用于保存包安装消息:anaconda.programJog用于调用 ...

  9. ajax原理以及优缺点(转)

    1.ajax技术的背景不可否认,ajax技术的流行得益于google的大力推广,正是由于google earth.google suggest以及gmail等对ajax技术的广泛应用,催生了ajax的 ...

  10. dedecms的if标签、foreach标签

    1.if标签 (1)下拉列表 <select name="prize_type[]" class="type J-prize-type" id=" ...