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

15130번 - Arithmetic Sequences 다국어

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

문제

An Arithmetic Sequence of integers is one in which the next number in the sequence is obtained by adding a constant to the current number. For example, this is an arithmetic sequence (the constant is 7):

3, 10, 17, 24, 31, …

Given a part of an arithmetic sequence with some numbers missing, fill in the missing numbers.

입력

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. Each test case will consist of a single line with exactly ten integers. Eight of them will be 0, the other two will be positive. The two positive integers may be anywhere among the ten integers, and will be no larger than 1,000. The 0 values represent missing values from the sequence.

출력

If it is possible to complete the sequence with integers, then output ten integers on a single line, with a single space between them, by replacing the 0 values with the correct numbers. If it is not possible to complete the sequence with integers, simply output a single -1. Although the two non-zero inputs are positive, the rest of the sequence might not be. Likewise, while the two non-zero inputs are ≤1,000, the rest of the sequence might not be.

제한

예제 입력 1

5 0 15 0 0 0 0 0 0 0

예제 출력 1

5 10 15 20 25 30 35 40 45 50

예제 입력 2

5 0 0 15 0 0 0 0 0 0

예제 출력 2

-1

예제 입력 3

0 0 0 15 0 3 0 0 0 0

예제 출력 3

33 27 21 15 9 3 -3 -9 -15 -21

예제 입력 4

0 0 19 0 0 0 0 0 19 0

예제 출력 4

19 19 19 19 19 19 19 19 19 19

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2017 Southeast USA Regional Programming Contest > Division 2 I번

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

출처

대학교 대회

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

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