ken_love_rin's blog

By ken_love_rin, history, 9 years ago, In English

Help me. thanks.

Give a sequence of numbers a1,a2...an. (n<=2*10^5, 0<a[i]<=10^6). Find the maximum of (a[i] mod a[j]) a[i]>=a[j], (1<=i,j<=n).

For example

input

3 2 4 5

output 1 ( 5 mod 4)

intput

3 15 22 44

output

14 ( 44 mod 15 ).

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The problem is from codeforces, here
Read the editorial here