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

建议使用的浏览器:

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

3396:Triangles

题目描述
Mr. Cooper was a celebrated scientist who had a really big lab. There were N sticks in this lab and the length of the i-th stick was i millimeters. One day, when Mr. Cooper decided to do research on triangles, he found that M of the sticks were missed. Mr. Cooper wanted to know how many kinds of triangles could be constructed by three of the remaining sticks. Two triangles are different if and only if they are formed by different sets of sticks.
For Example, there were 8 sticks in the lab originally and the second and the sixth sticks were missed. The 7 different triangles can be constructed were (3,4,5), (3,5,7), (4,5,7), (3,7,8), (4,7,8), (5,7,8), (4,5,8).
输入解释
The first line contains an integer T (T<=25) indicating the number of test cases. The first line of each test case contains two integers N (1<=N<=1000000000) and M (0<=M<=1000). If M is not zero, there is an additional line containing M distinct integers between 1 and N indicating the missed sticks.
输出解释
For each test case, print the case number and the answer % 1000000007 in a single line where the answer is the number of the triangles can be formed. Please follow the format of the sample output.
输入样例
3
3 0
8 2
2 6
58 3
23 5 3
输出样例
Case 1: 0
Case 2: 7
Case 3: 13861
来自杭电HDUOJ的附加信息
Author hanshuai@whu
Recommend notonlysuccess

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

源链接: HDU-3396

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

共提交 0

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