Question: Java pls Program 3 (50 points) In McAllen theater, Seats are arranged in the N by M grid. The number of each seat is indicated

 Java pls Program 3 (50 points) In McAllen theater, Seats are

Java pls

Program 3 (50 points) In McAllen theater, Seats are arranged in the N by M grid. The number of each seat is indicated by the coordinates of the corresponding grid. For example, when N = 3 and M = 5, the seats are like below. (3,1) (3,2)(3,3) (3,4) (3,5) (2,1) (2,2)(2,3) (2,4) (2,5) (1,1) (1,2) (1,3)|(1,4) (1,5) Many people stand in waiting lines to enter this venue. The waiting people receive the waiting list in the order 1, 2, 3, 4, ... from the front. We start with (1, 1) seats for people with a waiting number, turn clockwise and assign the audience to the empty seats in order like below. 3 2 2 4 5 6 7 13 14 158 12 11 10 9 1 If N and M are given, a program should be created to find the seat number (x, y) to be assigned to the audience whose waiting sequence is K. If there is no seat for K, the program returns 0. Input & Output Format T = number of test case Input T NMK NMK Output Example Input 3 67 11 6 7 87 100 100 3000 Output 66 0 9 64

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!