当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5203:Rikka with wood sticks

题目描述
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:


Yuta have a wood stick of length $n$ which consists of $n$ linked sticks of length $1$. So it has $n-1$ connection points. Yuta finds that some sticks of length $1$ of the wood stick are not strong. So he wants to choose three different connection points to cut it into four wood sticks and only one of them contains wood sticks which are not strong. And Yuta wants to minimize the length of this piece which contains bad wood sticks. Besides, Rikka wants to use the other three wood sticks to make a triangle. Now she wants to count the number of the ways to cut the wood sticks which can make both Yuta and herself happy.


It is too difficult for Rikka. Can you help her?
输入解释
This problem has multi test cases (no more than $20$). For each test case, The first line contains two numbers $n,m(1 \leq n \leq 1000000,1 \leq m \leq 1000)$. The next line contains m numbers (some of them may be same) – the position of each wood sticks which is not strong.
输出解释
For each test cases print only one number – the ways to cut the wood sticks.
输入样例
6 1
3
5 1
3
输出样例
2
0
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5203

最后修改于 2020-10-25T23:20:40+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)