Codeforces805 A. Fake NP
来源:互联网 发布:编辑身份证照片软件 编辑:程序博客网 时间:2024/05/21 12:49
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 longint 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
- CF411div2 A. Fake NP
- A. Fake NP
- A. Fake NP
- 805A Fake NP
- CodeForces 805A Fake NP
- CodeFroces 805A Fake NP
- Codeforces 805A Fake NP
- CF#805 A. Fake NP(水题)
- Codeforces Round #411 (Div. 2) A. Fake NP
- Codeforces Round #411 A.Fake NP (思维题)
- Codeforces Round #411 (Div. 2) A. Fake NP【水题】
- 小白题解 Codeforces 805A 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)
- setup a fake ap with backtrack5
- 第六章 异常
- 使用MATLAB加载文本数据
- Java 抽象类与接口
- hive中Partition详解
- 如果你觉得功能测试只是点点点,那请离开测试这行
- Codeforces805 A. Fake NP
- [莫队 bitset] BZOJ 4810 [Ynoi2017]由乃的玉米田
- SSL双向认证
- Intellij IDEA+Tomcat+JRebel热部署
- Codeforces Round #411 C. Find Amir
- 基于SSM框架maven管理的RAS密码加密算法
- [线段树] BZOJ 4821 [Sdoi2017]相关分析
- Codeforces Round #411 D. Minimum number of steps
- Codeforces805B. 3-palindrome