codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

805A.md (1175B)


      1 Source: https://codeforces.com/problemset/problem/805/A
      2 
      3 A. Fake NP
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.
     22 
     23 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.
     24 
     25 Solve the problem to show that it's not a NP problem.
     26 
     27 Input
     28 
     29 The first line contains two integers *l* and *r* (2 ≤ *l* ≤ *r* ≤ 109).
     30 
     31 Output
     32 
     33 Print single integer, the integer that appears maximum number of times in the divisors.
     34 
     35 If there are multiple answers, print any of them.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 19 29
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 2
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 3 6
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 3
     61 ```
     62 
     63 Note
     64 
     65 Definition of a divisor: <https://www.mathsisfun.com/definitions/divisor-of-an-integer-.html>
     66 
     67 The first example: from 19 to 29 these numbers are divisible by 2: {20, 22, 24, 26, 28}.
     68 
     69 The second example: from 3 to 6 these numbers are divisible by 3: {3, 6}.