题库练习 Maximum Value
← 上一题 下一题 →

A9757 | Maximum Value

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given a sequence $a$ consisting of $n$ integers. Find the maximum possible value of ![](/uploads/acgo/image/f18357efc913a58e_eaf7420b1946.jpeg) (integer remainder of $a_{i}$ divided by $a_{j}$ ), where $1<=i,j<=n$ and $a_{i}>=a_{j}$ .

输入格式

You are given a sequence $a$ consisting of $n$ integers. Find the maximum possible value of ![](/uploads/acgo/image/50ff45774ec2f546_2e3f3c997ea3.jpeg) (integer remainder of $a_{i}$ divided by $a_{j}$ ), where $1<=i,j<=n$ and $a_{i}>=a_{j}$ .

输出格式

Print the answer to the problem.

输入输出样例

输入 #1
3
3 4 5
输出 #1
2
C++ 编辑器
输入
输出