题库练习 Lengthening Sticks
← 上一题 下一题 →

A10048 | Lengthening Sticks

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given three sticks with positive integer lengths of $a,b$ , and $c$ centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different length), but in total by at most $l$ centimeters. In particular, it is allowed not to increase the length of any stick.

Determine the number of ways to increase the lengths of some sticks so that you can form from them a non-degenerate (that is, having a positive area) triangle. Two ways are considered different, if the length of some stick is increased by different number of centimeters in them.

输入格式

The single line contains $4$ integers $a,b,c,l$ ( $1<=a,b,c<=3·10^{5}$ , $0<=l<=3·10^{5}$ ).

输出格式

Print a single integer — the number of ways to increase the sizes of the sticks by the total of at most $l$ centimeters, so that you can make a non-degenerate triangle from it.

输入输出样例

输入 #1
1 1 1 2
输出 #1
4
输入 #2
1 2 3 1
输出 #2
2
输入 #3
10 2 1 7
输出 #3
0
C++ 编辑器
输入
输出