A8696 | LCM Challenge
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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?
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?
输入格式
The first line contains an integer $n$ ( $1<=n<=10^{6}$ ) — the $n$ mentioned in the statement.
输出格式
Print a single integer — the maximum possible LCM of three not necessarily distinct positive integers that are not greater than $n$ .
输入输出样例
输入 #1
9
输出 #1
504
输入 #2
7
输出 #2
210
The least common multiple of some positive integers is the least positive integer which is multiple for each of them.
The result may become very large, 32-bit integer won't be enough. So using 64-bit integers is recommended.
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.
The result may become very large, 32-bit integer won't be enough. So using 64-bit integers is recommended.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted