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

17653번 - Ruler 스페셜 저지다국어

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

문제

Elly has a very strange measuring ruler. It has length exactly L centimeters and has marks at some (but not necessarily all) positions at integer distances from the beginning. We assume the ruler has marks at its beginning (0) and end (L). The very peculiar thing about this ruler is that all distances between any two (not necessarily neighboring) marks are distinct! More formally, if the ruler has marks at positions 0 = A1 < A2 < ... < AN = L, then (for 1 ≤ i, j, k, p ≤ N and i < j) Aj - Ai = Ak - Ap if and only if j = k and i = p.

Now Elly wants to create such a ruler with N marks, requiring it to be as short as possible. Write a program to help her.

입력

On a single line of the standard input will be given one integer N – the number of marks (including the beginning and end), which the ruler should have.

출력

On a single line of the standard output print N non-negative integers, ordered in increasing order – the positions of the marks of the ruler. The frst position must be 0 and the last must be L, where L is the least possible length, allowing such a ruler with N marks. If more than one solution exists, you can print any of them.

제한

  • 5 ≤ N ≤ 14

예제 입력 1

5

예제 출력 1

0 2 7 8 11

The minimal length of a ruler with the described properties with 5 marks is 11. With the given choice of mark positions, all distances between pairs of marks are: {2, 7, 8, 11, 5, 6, 9, 1, 4, 3}.

Another possible solution for N = 5 would be {0, 1, 4, 9, 11}.

예제 입력 2

8

예제 출력 2

0 1 4 9 15 22 32 34

힌트

출처

Olympiad > International Autumn Tournament in Informatics > 2018 > Group A (Seniors) 1번

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

출처

대학교 대회

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

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