Logo
(追記) (追記ここまで)

28176번 - Maximum GCD 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB3001108033.613%

문제

Grammy has an array of length $n$. She recently learned about the concept of greatest common divisor(GCD). Recall that the GCD of an array is the maximum integer $d$ such that every element in the array is divisible by $d$. Grammy thinks that the GCD of an array should be as large as possible so that the array can be beautiful.

You want to help Grammy to make her array beautiful, so you decided to do some (possibly zero) modulo operations on each of the elements in the array. In other words, for each operation, you can choose a number $a_i$ (1ドル \leq i \leq n$) in the array and choose another integer $x,ドル and then replace $a_i$ with $(a_i\bmod x)$. Since Grammy does not want 0ドル$ to appear in her array, you cannot change $a_i$ into 0ドル$ by doing the modulo operation.

Now, your task is to calculate the maximum GCD of the array after several (possibly zero) modulo operations.

입력

The first line contains a single integer $n$ (1ドル \leq n \leq 10^5$), denoting the number of elements in the array.

The second line contains $n$ positive integers $a_i$ (1ドル \leq a_i \leq 10^9$), denoting the initial elements of Grammy's array.

출력

Output a single integer, denoting the maximum GCD of the array after any number of modulo operations.

제한

예제 입력 1

3
3 10 7

예제 출력 1

3

힌트

출처

ICPC > Regionals > Asia East Continent > Hong Kong > 2023 ICPC Hong Kong Regional K번

Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 3: 2023 ICPC Asia Hong Kong Regional K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /