|
|||
TriplesGiven a sequence of positive integers, you need to find the number of triples in that sequence. For this problem, (x, y, z) constructs a triple if and only if x + y = z. So, (1, 2, 3) is a triple, while (3, 4, 5) is not. Input SpecificationThe input consists of several test cases. Each test case starts with a positive integer N (3 ≤ N ≤ 5000). The next few lines contain N positive integers. The input is terminated by EOF. Output SpecificationFor each test case, print the number of triples in the sequence in a line by itself. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |