• [1637] A hard problem

  • 时间限制: 6000 ms 内存限制: 65535 K
  • 问题描述
  • You are given a sequence a consisting of n integers.Find the maximum possible value of a[i] mod a[j] where 1<=i,j<=n and a[i]
    >=a[j].
  • 输入
  • The first line contains integer n - the length of the sequence(1<=n<=2*10^5)
    The second line contains n space-separated integers a[i](1<=a[i]<=10^6)
  • 输出
  • Print the answer to the problem
  • 样例输入
  • 3
    3 4 5
    3 
    1 2 4
  • 样例输出
  • 2
    0
  • 提示
  • 来源
  • Radical@NBUT
  • 操作

显示春菜