#P9690. [GDCPC 2023] Programming Contest
[GDCPC 2023] 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 .