Programming contests

ACM ICPC programozó csapatverseny, házi forduló, 2018. október 31.

October 31, 2018, 10:10 AM – October 31, 2018, 3:10 PM

Art

Vera has five sticks of distinct lengths l1, l2, l3, l4, l5. Vera may choose any three of the five sticks to form the sides of a triangle. How many different triangles can Vera make? Each triangle must have positive area, and sticks cannot be bent or cut.

Input Specification

Line 1 contains integers l1, l2, l3, l4, l5 (1 ≤ li ≤ 1000).

Output Specification

Print one line with one integer, the number of ways to form a triangle.

Sample Input 1

  1. 1 2 3 4 5
download as text file

Output for Sample Input 1

  1. 3
download as text file

Sample Input 2

  1. 1 2 4 8 16
download as text file

Output for Sample Input 2

  1. 0
download as text file

Note

For the first example, the 3 ways to form a triangle are choosing sticks 2, 3, 4 or 2, 4, 5 or 3, 4, 5.

University of Debrecen; Faculty of Informatics; v. 09/30/2024