Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Language// Output must be exactly the same In McAllen theater, Seats are arranged in the N by M grid. The number of each seat

image text in transcribedimage text in transcribedJava Language// Output must be exactly the same

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 N3 and M-5, the seats are like below 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 4 5 6 7 2 13 14 15 8 1 12 11 10 9 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 Tnumber of test case Input N M K N M K Output x y x y Example Input 6 7 11 6 7 87 100 100 3000 Input & Output Format Tnumber of test case Input N M K NM K Output x Y x Y Example Input 6 7 11 67 87 100 100 3000 Output 9 64

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions