codeforces-scrape

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

235A.md (1273B)


      1 Source: https://codeforces.com/problemset/problem/235/A
      2 
      3 A. LCM Challenge
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
     22 
     23 But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be distinct) which are not greater than *n*. Can you help me to find the maximum possible least common multiple of these three integers?
     24 
     25 Input
     26 
     27 The first line contains an integer *n* (1 ≤ *n* ≤ 106) — the *n* mentioned in the statement.
     28 
     29 Output
     30 
     31 Print a single integer — the maximum possible LCM of three not necessarily distinct positive integers that are not greater than *n*.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 9
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 504
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 7
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 210
     57 ```
     58 
     59 Note
     60 
     61 The least common multiple of some positive integers is the least positive integer which is multiple for each of them.
     62 
     63 The result may become very large, 32-bit integer won't be enough. So using 64-bit integers is recommended.
     64 
     65 For the last example, we can chose numbers 7, 6, 5 and the LCM of them is 7·6·5 = 210. It is the maximum value we can get.