Codeforces805 A. Fake NP 2017-05-05 08:30 327人阅读 评论(0) 收藏
1 second
256 megabytes
standard input
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.
The first line contains two integers l and r (2 ≤ l ≤ r ≤ 109).
Print single integer, the integer that appears maximum number of times in the divisors.
If there are multiple answers, print any of them.
19 29
2
3 6
3
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) 收藏的更多相关文章
- 周赛-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 ...
- 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 ...
- c#委托和事件(下) 分类: C# 2015-03-09 08:42 211人阅读 评论(0) 收藏
C#中的委托和事件(下) 引言 如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...
- .net 实现Office文件预览 Word PPT Excel 2015-01-23 08:47 63人阅读 评论(0) 收藏
先打个广告: .Net交流群:252713569 本人QQ :524808775 欢迎技术探讨, 近期公司要求上传的PPT和Word都需要可以在线预览.. 小弟我是从来没有接触过这一块的东西 感觉很棘 ...
- 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 ...
- 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 ...
- 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 ...
- 周赛-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 ...
- 周赛-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 ...
随机推荐
- sql查询分析器中显示行号
-- 工具-> -- 选项-> -- 文本编辑器-> -- 所有语言-> -- 常规-> -- 显示-> -- 行号
- lrzsz的安装与配置
1)下载http://freshmeat.sourceforge.net/projects/lrzsz/ 2)tar zxvf lrzsz-0.12.20.tar.gz 3)mv lrzsz-0.12 ...
- C语言实现24点程序
一.简介 本程序的思想和算法来自于C语言教材后的实训项目,程序通过用户输入四个整数计算出能够通过加减乘除得到数字24的所有表达式,程序的设计有别于一般通过穷举实现的方式,效率得到提高.算法介绍如下: ...
- 奇偶数判断1(if,else if语句)
public class 奇偶数判断 { public static void main(String [] args){ float s = 9f; //取单浮点型变量s,可为任意值 float h ...
- 使用UUID方法生成全球唯一标识
需要生成唯一字符串,如生成应用标识等,可以直接用java.util.UUID类实现. UUID(Universally Unique Identifier)全局唯一标识符,是指在一台机器上生成的数字, ...
- php页面的基本语法
概述: 1. PHP 脚本在服务器上执行,然后将纯 HTML 结果发送回浏览器. 2. PHP 脚本以 <?php 开始,以 ?> 结束,可以放到文档中的任何位置. 3. 当 PHP 解析 ...
- iOS 静态库的封装
参考网址:http://www.jianshu.com/p/b754709135fb http://www.jianshu.com/p/443a5b8f3894 注意:封装静态库时要注意的地方: ...
- word2003设置页码不从第一页开始的方法
问题描述:如果你想设置页码从第三四页开始,前边不要页码,或者前边的页码是不同类型的.那么这个时候就要用到:插入->分隔符模式. 如果你的页面中的各个标题是从样式和格式中选择的,既是你先设置好各种 ...
- c#中@的3种作用
以前只知道@在C#中为了写文件路径的\不要加转义符而在前面加上@标识符,没想到@还有其他的作用 1.忽略转义字符例如 string fileName = "D:\\文本文件\\text.tx ...
- jmeter完成数据批量添加
Jmeter结构如图 目的: 需要在每个组织下面分别添加5个设备资源 思路: 1.先登录平台 2.进入系统配置页面 3.获取到每个区域的ID 4.在每个区域下面添加设备资源 重点及难点: 1.登录加密 ...