Cấp số cộng

View as PDF

Submit solution

Points: 0.77 (partial)
Time limit: 1.0s
Memory limit: 256M
Input: stdin
Output: stdout

Problem type
Allowed languages
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Cho dãy có ~2 \times n~ số tìm cấp số cộng có độ dài ~n~.

Input

  • Dòng đầu tiên chứa số ~n~.
  • Dòng thứ ~2~ chứa ~2 \times n~ số nguyên ~a_1, a_2, \dots a_{2 \cdot n}~.

Output

Dòng duy nhất chứa giá trị của số hạng đầu tiên và công sai của cấp số. Nếu có nhiều kết quả thì in ra giá trị bất kỳ.

Giới hạn

  • ~n \le 10^{5}~.
  • ~|a_i|\le 10^{9}~.

Sample Input

3
8 7 1 5 4 3

Sample Output

3 1

Comments

Please read the guidelines before commenting.


There are no comments at the moment.