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

13280번 - Selection of Participants of an Experiment 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB23520618387.143%

문제

Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of the experiment, one of them will be trained under the conventional method and the other under his new method. Comparing the final scores of these two, he will be able to judge the effectiveness of his method.

It is important to select two students having the closest possible scores, for making the comparison fair. He has a list of the scores of all students who can participate in the experiment. You are asked to write a program which selects two of them having the smallest difference in their scores.

입력

The input consists of multiple datasets, each in the following format.

n
a1 a2 … an

A dataset consists of two lines. The number of students n is given in the first line. n is an integer satisfying 2 ≤ n ≤ 1000. The second line gives scores of n students. ai (1 ≤ i ≤ n) is the score of the i-th student, which is a non-negative integer not greater than 1,000,000.

The end of the input is indicated by a line containing a zero. The sum of n's of all the datasets does not exceed 50,000.

출력

For each dataset, select two students with the smallest difference in their scores, and output in a line (the absolute value of) the difference.

제한

예제 입력 1

5
10 10 10 10 10
5
1 5 8 9 11
7
11 34 83 47 59 29 70
0

예제 출력 1

0
1
5

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > Japan Domestic Contest > 2016 Japan Domestic Contest A번

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

출처

대학교 대회

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

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