Rikka with wood sticks(hdu5203)

发布时间:2017-1-25 7:17:32 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"Rikka with wood sticks(hdu5203) ",主要涉及到Rikka with wood sticks(hdu5203) 方面的内容,对于Rikka with wood sticks(hdu5203) 感兴趣的同学可以参考一下。

Rikka with wood sticks(hdu5203)

Rikka with wood sticks

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1166    Accepted Submission(s): 356

Problem Description
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 n1 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(1n1000000,1m1000). 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.
Sample Input

上一篇:Delphi 10.1 Berlin Starter Edition