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

4145번 - Geometric Sequence 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB303222.222%

문제

A sequence of integers is called a geometric sequence if the ratio of consecutive numbers is constant. For example, (3,6,12,24) is a geometric sequence (each term is equal to twice the previous number).

Now, with such a sequence, we will shuffle it and remove some of the elements. Given the result of such a transformation, try to recover the "geometric ratio" of the original sequence, i.e. the ratio of consecutive numbers.

If there are multiple possible ratios, output the one with the greatest absolute value. If there is still a tie, output the positive one. If there is no such sequence, output 0.

입력

The first line of input contains a single integer, 2 ≤ N ≤ 100,000, the number of integers in the transformed sequence.
Following this will be N lines, each containing a single integer of the transformed sequence (each element will be less than or equal to 1018 in absolute value, and no element will be zero).

출력

The ratio of the original sequence (if one exists). The relative error of the answer must be within 10-9. That is, (abs(answer - expected) / expected < 10-9).

제한

예제 입력 1

3
1
3
27

예제 출력 1

3

힌트

출처

Contest > Waterloo's local Programming Contests > 24 September, 2011 C번

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

출처

대학교 대회

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

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