Question: C Programming Language Be-Es is a dormitory for university student. It has 18 floors and a lift. Jojo lives at 18th floor in there Recently,

C Programming Language

C Programming Language Be-Es is a dormitory for university student. It has

Be-Es is a dormitory for university student. It has 18 floors and a lift. Jojo lives at 18th floor in there Recently, he is annoyed with the new resident in there. Each time he uses lift, the lift will stop in almost every floor. The new residents are too lazy to use the stair to go up or down 1 floor. To educate them, Jojo makes a problem in hope that they will change. In this problem, there are N people. They enter the lift one by one. Each of them has a floor that they want to visit. They will only press the button if no one has pressed the floor 1 above or 1 below of his / her destination. Find the number of people that press the button! Format Input The input begins with an integer T indicating the number of test cases. In each test case, there is an integer N indicating the number of people. In the next line, there are N positive numbers describing the floor destination of the i-th people that enter the lift. You may assume that the number will be less than equal to 18 and none of it will be 1 Format Output For each test case, print the number of people that press the button! Constraints 1N

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!