Submit solution
Points:
0.25 (partial)
Time limit:
1.0s
Memory limit:
256M
Input:
stdin
Output:
stdout
Problem source:
Problem type
Allowed languages
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Cho dãy số nguyên không âm ~a_{1}, a_{2}, \ldots, a_{n}~, hãy đếm số bộ ba chỉ số ~i \lt k \lt j~ sao cho ~a_{i}+a_{j}=~ ~2 \times a_{k}~.
Dữ liệu:
Dòng đầu tiên ghi số nguyên dương ~T(T \leq 10)~ là số lượng bộ dữ liệu. Tiếp đến là ~T~ nhóm dòng, mỗi nhóm tương ứng với một bộ dữ liệu có cấu trúc như sau:
- Dòng đầu chứa số nguyên ~n~;
- Dòng thứ hai gồm ~n~ số ~a_{1}, a_{2}, \ldots, a_{n}\left(\left|a_{i}\right| \leq 10^{9}\right)~.
Kết quả:
- Ghi ra gồm ~T~ dòng, mỗi dòng chứa một số là kết quả tương ứng với bộ dữ liệu vào.
Ví dụ:
Sample Input
2
3
1 2 5
3
1 1 1
Sample Output
0
1
Chấm điểm:
Subtask 1: ~n \leq 100~;
Subtask 2: ~n \leq 1000~.
Comments