测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A9757. Maximum Value

编程题 普及/提高-

题目描述

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
上一题 去做题 下一题