Like any unknown mathematician, Yuri has favourite numbers:
holds?
Yuri is preparing problems for a new contest now, so he is very busy. That's why he asked you to calculate the number of triangles with described property.
The triangle is called non-degenerate if and only if its vertices are not collinear.
The first line contains four integers:
) — Yuri's favourite numbers.
Print the number of non-degenerate triangles with integer sides
holds.
1 2 3 4
4
1 2 2 5
3
500000 500000 500000 500000
1
In the first example Yuri can make up triangles with sides
.
In the second example Yuri can make up triangles with sides
, and.
In the third example Yuri can make up only one equilateral triangle with sides equal to
length = len(l)
count = 0
for a in range(l[0] , l[1]+1) :
for b in range(l[1],l[2]+1) :
for c in range(l[2] ,l[3]+1) :
if a+b > c and b+c > a and c+a > b :
count += 1
print(count)