A. Fake NP
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:
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}.
题目链接:http://codeforces.com/contest/805/problem/A
分析:直接判断l==r就输出l,否则输出2就可以了!
下面给出AC代码:
1 #include2 using namespace std; 3 int main() 4 { 5 int l,r; 6 scanf("%d%d",&l,&r); 7 if(l==r) 8 cout< <