Please write answer code using Java.
We have ping pong room in our office and there is one table.
What we want to know is when we know people's availability for their playing time, how many hours can we play either singles or doubles in a day.
condition:
The working hours are 9-18.
The table is only one table.
When gathering two, three people, we can play singles.
When gathering over four people, we can play doubles.
Input
The first line of the input gives the number of players T, T players available time follow.
Each consists of one line with Integer S E. S represents start time, and E represents end time.
Ex:
2
9 10
9 12
It means 2 players can play ping pong. The 1st player can play from 9 to 10 and the 2nd player can play ping pong from 9 to 12.
Output:
The output one line containing x y. where x is singles hours count and y is double hours.
The above input means player 1 can play ping pong from 9 to 10, and player 2 can play ping pong from 9 to 12.
So, expected output of above example is
1 0
Data you need to solve is here:
Q1
Input
2
9 10
9 12
Output : 1 0
Q2
Input
4
9 10
9 12
13 15
10 18
Output: 5 0
Q3
Input
7
9 11
12 14
13 15
11 18
14 18
10 14
15 18
Output: 7 1
Q4
Input
9
9 10
9 12
14 15
16 18
14 18
10 13
15 18
10 14
9 13
Output : 6 2
Q5
Input
8
9 14
15 17
12 13
16 18
10 15
14 16
9 13
9 15
Output : 5 3
Nice problem. I can solve it. Please assign project to me and I can provide you solution.
Please share if you other such problems. It's always fun solving these.
I am a college A-level student studying computer science and am working at an A. I have been programming in Java for years and feel that this project will not take long to complete.
Relevant Skills and Experience
I have picked up many skills in the time I have been programming such as polymorphism, encapsulation, generics and lambdas. I have experience in JavaFX and console applications.
Proposed Milestones
₹855 INR - I will complete this task and make it bug-free.