PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBAHAI0000060. Phần tử gần trung bình nhất (Element Closest to the Average)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phần tử gần trung bình nhất (Element Closest to the Average)
Element Closest to the Average (Phần tử gần trung bình nhất)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given integers , define
Choose the smallest index minimizing . Equivalently, with , compare
using integer arithmetic. Print and .
Input
The first line contains . The second line contains integers .
Output
Print p a_p, where is the selected 0-based index.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
5
1 4 8 10 12
Output
2 8
Explanation
The sample follows the definitions and rules above.