码农谷 > 问答 > 编程题 > Lengthening Sticks

Lengthening Sticks

提问者: 老码农     发布时间:2017-01-11     浏览:3     回复:0     悬赏: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.

Input

The single line contains 4 integers a, b, c, l (1 ≤ a, b, c ≤ 3·105, 0 ≤ l ≤ 3·105).

Output

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 2

输出样例:
4

我要挑战
其他解答 共0条
 
温馨提示:本问答中心的任何言论仅代表发言者个人的观点,与码农谷立场无关。请对您的言论负责,遵守中华人民共和国有关法律、法规。如果您的言论违反码农谷问答中心的规则,将会被删除。
验证码: 看不清?点击图片更换    

关注码农谷微信
专家推荐
老码农     向TA提问 最佳答案:67
冰点     向TA提问 最佳答案:28
itner     向TA提问 最佳答案:11
关于我们   |   免责声明   |   联系我们   |   网站地图   |   HR交流群   |   学生交流群   |   教师交流群

码农谷   版权所有 © 2015-2017   湘ICP备16018319号-1