codeforces-scrape

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

483A.md (2032B)


      1 Source: https://codeforces.com/problemset/problem/483/A
      2 
      3 A. Counterexample
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Your friend has recently learned about coprime numbers. A pair of numbers {*a*, *b*} is called coprime if the maximum number that divides both *a* and *b* is equal to one.
     22 
     23 Your friend often comes up with different statements. He has recently supposed that if the pair (*a*, *b*) is coprime and the pair (*b*, *c*) is coprime, then the pair (*a*, *c*) is coprime.
     24 
     25 You want to find a counterexample for your friend's statement. Therefore, your task is to find three distinct numbers (*a*, *b*, *c*), for which the statement is false, and the numbers meet the condition *l* ≤ *a* < *b* < *c* ≤ *r*.
     26 
     27 More specifically, you need to find three numbers (*a*, *b*, *c*), such that *l* ≤ *a* < *b* < *c* ≤ *r*, pairs (*a*, *b*) and (*b*, *c*) are coprime, and pair (*a*, *c*) is not coprime.
     28 
     29 Input
     30 
     31 The single line contains two positive space-separated integers *l*, *r* (1 ≤ *l* ≤ *r* ≤ 1018; *r* - *l* ≤ 50).
     32 
     33 Output
     34 
     35 Print three positive space-separated integers *a*, *b*, *c* — three distinct numbers (*a*, *b*, *c*) that form the counterexample. If there are several solutions, you are allowed to print any of them. The numbers must be printed in ascending order.
     36 
     37 If the counterexample does not exist, print the single number -1.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 2 4
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 2 3 4
     51 ```
     52 
     53 Input
     54 
     55 ```
     56 10 11
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 -1
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 900000000000000009 900000000000000029
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 900000000000000009 900000000000000010 900000000000000021
     75 ```
     76 
     77 Note
     78 
     79 In the first sample pair (2, 4) is not coprime and pairs (2, 3) and (3, 4) are.
     80 
     81 In the second sample you cannot form a group of three distinct integers, so the answer is -1.
     82 
     83 In the third sample it is easy to see that numbers 900000000000000009 and 900000000000000021 are divisible by three.