Preparing for Exams in a Day

Topics: Prime number, Natural number, Integer Pages: 3 (880 words) Published: October 28, 2014

Where's my pages ?Input : Standard Input Output : Standard Output Time Limit : 1 sec  Bob had an exam the next day and had just sat to study. That's when he noticed that his naughty sister had torn pages from his textbook away. He searched the whole house and got a set of pages from each room. He listed the page numbers on each page that he found. Bob wants to know if there are any more pages still missing. Help Bob count the number of pages still missing. Input

The first line contains an integer T. The number of test cases.For each test case the first line contains the last page number N.The second line contains the number of rooms R from which Bob collected the pages. The following R lines contains an integer P followed by P integers. Output

The total number of pages missing.Print the answer for each test case in a seperate line. Constraints :1<=T<=100
1<=N<=500
1<=R<=10
0<=P<= (N/2)
Each of the P integers will contain the page number on either side of the page. It is guarnteed that each page will appear only once in each test case. See the sample case for more explanation.  Sample Input

2
5
1
2 1 4
12
3
2 1 3
1 10
2 6 11
Sample Output
1
1
Explanation :First Test Case: Page 1/2 and Page 3/4 were found. Page with page number 5 is missing. Marathon Runner
Input : Standard Input Output : Standard Output Time Limit : 1 sec  Bob was conduction a marathon for World Excercise day. The marathon was n kilo meters long. Bob wanted to place refreshments at P points within the race. The supply was given at mile marker 0. Each of the P places had a van each. Each van would travel only till the next refreshment point. Find out of all the vans which van travelled the most. Input

The first line contains an integer T. The number of test cases.For each test case the first line contains two integers N,P.N - the total distance of the marathons and P - the number of refreshment spots. In the next line P space seperated integers are...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Preparing for an Exam Essay
  • Essay on Preparing for and Taking Exams
  • exam Essay
  • exam Essay
  • Exam Essay
  • Exam Essay
  • Essay about exam
  • preparing and serving wines Essay

Become a StudyMode Member

Sign Up - It's Free