luogu#P9690. [GDCPC2023] Programming Contest
[GDCPC2023] Programming Contest
题目描述
Guangdong Province is one of the earliest province in China which holds its own provincial collegiate programming contest. Sun Yat-sen University hosted the first Guangdong Collegiate Programming Contest in year . After that, other universities in Guangdong, such as South China Agricultural University, South China University of Technology and South China Normal University, also hosted the contest. The contest is held once a year except for year due to the epidemic. In year , Shenzhen Technology University will host the twentieth Guangdong Collegiate Programming Contest. We are looking forward to seeing participants' outstanding performance!
In another world, a programming contest has been held once a year since year , except for the years when it was not held due to special reasons.
Calculate the number of times the competition has been held up to year (inclusive).
输入格式
There are multiple test cases. The first line of the input contains an integer () indicating the number of test cases. For each test case:
The first line contains an integer () indicating the first year when the contest was held.
The second line first contains an integer () indicating the number of years the contest was not held. Then integers () follow, indicating the years when the contest was not held. These years are given in increasing order and have no duplicates.
The third line contains an integer (). It's guaranteed that is not a year when the contest was not held.
输出格式
For each test case output one line containing one integer, indicating the number of times the competition has been held up to year (inclusive).
题目大意
【题目描述】
广东省是全国较早一批将程序设计竞赛引入省内大学生竞赛体系的省份之一。 年,中山大学承办了第一届广东省大学生程序设计竞赛。此后,华南农业大学、华南理工大学、华南师范大学等省内高校也先后承办了此赛事,除 年因疫情停办外,每年一届。 年,深圳技术大学将承办第二十届广东省大学生程序设计竞赛,让我们期待选手们出色的表现!
在另一个世界中,某程序设计竞赛自 年起开始举办。除了 这 年由于特殊原因无法举办之外,其他年份每年举办一次。
求 年是该竞赛的第几次举办。
【输入格式】
有多组测试数据。第一行输入一个整数 ()表示测试数据组数。对于每组测试数据:
第一行输入一个整数 (),表示该竞赛第一次举办的年份。
第二行首先输入一个整数 ()表示该竞赛停办的年份数,之后输入 个整数 ()表示该竞赛的停办年份。停办年份按递增顺序给出,且没有重复的年份。
第三行输入一个整数 ()。保证 不是停办年份之一。
【输出格式】
每组数据输出一行一个整数,表示 年是该竞赛的第几次举办。
【样例解释】
对于第一组样例数据,如题目描述中所述,答案为 。
对于第二组样例数据,由于 就是该竞赛第 次举办的年份,因此答案为 。
对于第三组样例数据,由于竞赛从未停办,因此答案为 。
对于第四组样例数据,该竞赛前 次举办的年份为 ,,, 与 。因此答案为 。
4
2003
1 2020
2023
2003
1 2020
2003
2345
0
3456
3000
4 3001 3003 3004 3008
3007
20
1
1112
5
提示
For the first sample test case, as described in the problem description, the answer is .
For the second sample test case, because year is the -st year when the contest was held, the answer is .
For the third sample test case, because the contest was held every year, the answer is .
For the fourth sample test case, the first years when the contest was held is , , , and . So the answer is .