CodeFroces 805A Fake NP
来源:互联网 发布:php域名授权函数 编辑:程序博客网 时间:2024/04/30 17:03
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}.
给出一个区间,问这个区间内的数字能整除的数字最多的是什么。这个数字不能是1。
所以,那肯定是2啊?当然,如果l == r的话,那就输出l。
代码如下:
#include<bits/stdc++.h>using namespace std; int main(){int l, r;cin >> l >> r;if(l != r)cout << "2" << endl; elsecout << l << endl;return 0;}
- CodeFroces 805A Fake NP
- 805A Fake NP
- CodeForces 805A Fake NP
- Codeforces 805A Fake NP
- CF#805 A. Fake NP(水题)
- Codeforces805 A. Fake NP
- CF411div2 A. Fake NP
- A. Fake NP
- A. Fake NP
- 小白题解 Codeforces 805A Fake NP
- Codeforces Round #411 (Div. 2) A. Fake NP
- Codeforces Round #411 A.Fake NP (思维题)
- Codeforces Round #411 (Div. 2) A. Fake NP【水题】
- Fake NP (Codeforces
- codeforces 411div2-fake NP
- Codeforces Round #411 A.Fake NP【数论有关因数结论+经验】
- Codeforces Round #411(A. Fake NP; B. 3-palindrome; C. Find Amir; D.Minimum number of steps)
- codefroces A. Cut Ribbon
- 快速排序算法 Java实现
- 《人民的名义》第二部剧情简介
- Office设置不同章节的页眉页脚及下划线的清除与添加
- 400 badrequest问题
- 数据结构复习0.概论
- CodeFroces 805A Fake NP
- 2016微信公开课·张小龙演讲全文(上)
- @RequestMapping用法的简单介绍
- 单个字符串匹配
- 存贮过程实现金额小写转换为大写
- String.compareTo()方法
- 2017.5.5 小朋友的数字 思考记录
- Maven简介
- ListView悬浮头部展示效果